pub struct Arena<K: Key, V> { /* private fields */ }Expand description
阶段 1 直接复用 slotmap,后续如需自定义 generational index 再替换。
Implementations§
Source§impl<K: Key, V> Arena<K, V>
impl<K: Key, V> Arena<K, V>
pub fn new() -> Self
pub fn insert(&mut self, value: V) -> K
pub fn get(&self, id: K) -> Option<&V>
pub fn get_mut(&mut self, id: K) -> Option<&mut V>
pub fn remove(&mut self, id: K) -> Option<V>
pub fn contains(&self, id: K) -> bool
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Forget for Arena<K, V>
impl<K, V> Freeze for Arena<K, V>
impl<K, V> Move for Arena<K, V>
impl<K, V> RefUnwindSafe for Arena<K, V>where
SlotMap<K, V>: RefUnwindSafe,
impl<K, V> Send for Arena<K, V>
impl<K, V> Sync for Arena<K, V>
impl<K, V> Unpin for Arena<K, V>
impl<K, V> UnsafeUnpin for Arena<K, V>where
SlotMap<K, V>: UnsafeUnpin,
impl<K, V> UnwindSafe for Arena<K, V>where
SlotMap<K, V>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more