pub struct ObjectArena<T> { /* private fields */ }Expand description
Arena allocator that bump-allocates objects of type T.
Implementations§
Source§impl<T> ObjectArena<T>
impl<T> ObjectArena<T>
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Create an empty arena with a pre-allocated hint.
Sourcepub fn alloc(&mut self, value: T) -> ArenaHandle
pub fn alloc(&mut self, value: T) -> ArenaHandle
Allocate an object and return its handle.
Sourcepub fn get(&self, handle: ArenaHandle) -> Option<&T>
pub fn get(&self, handle: ArenaHandle) -> Option<&T>
Get a reference, validating the generation.
Sourcepub fn generation(&self) -> Generation
pub fn generation(&self) -> Generation
Current generation counter.
Auto Trait Implementations§
impl<T> Freeze for ObjectArena<T>
impl<T> RefUnwindSafe for ObjectArena<T>where
T: RefUnwindSafe,
impl<T> Send for ObjectArena<T>where
T: Send,
impl<T> Sync for ObjectArena<T>where
T: Sync,
impl<T> Unpin for ObjectArena<T>where
T: Unpin,
impl<T> UnsafeUnpin for ObjectArena<T>
impl<T> UnwindSafe for ObjectArena<T>where
T: 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