wip: merge in some code from the other branch

This commit is contained in:
Jonathan Kelley committed 2021-06-05 23:47:54 -04:00
1 parent 795a54a2e4
commit 7790750349
12 files changed
+782 -124

No files matched your search

+9 -2
View File
@@ -9,9 +9,9 @@ use generational_arena::Arena;
use crate::innerlude::*;
#[derive(Clone)]
pub struct ScopeArena(Rc<RefCell<ScopeArenaInner>>);
pub struct ScopeArena(pub Rc<RefCell<ScopeArenaInner>>);
struct ScopeArenaInner {
pub struct ScopeArenaInner {
pub(crate) arena: UnsafeCell<Arena<Scope>>,
locks: HashMap<ScopeIdx, MutStatus>,
}
@@ -61,6 +61,13 @@ impl ScopeArena {
// todo!()
}
pub fn try_remove(&mut self, id: ScopeIdx) -> Result<Scope> {
let inner = unsafe { &mut *self.0.borrow().arena.get() };
inner
.remove(id)
.ok_or_else(|| Error::FatalInternal("Scope not found"))
}
unsafe fn inner_unchecked<'s>() -> &'s mut Arena<Scope> {
todo!()
}