pub struct Arena<T> { /* private fields */ }Expand description
An arena allocator for efficiently storing and accessing elements.
The arena allocates elements sequentially and returns type-safe ArenaIds
that can be used to retrieve elements later. This pattern provides fast allocation
and cache-friendly access.
Implementations§
Source§impl<T: Clone + PartialEq> Arena<T>
impl<T: Clone + PartialEq> Arena<T>
Sourcepub fn alloc(&mut self, value: T) -> ArenaId<T>
pub fn alloc(&mut self, value: T) -> ArenaId<T>
Allocates a value in the arena and returns its identifier.
Sourcepub fn contains(&self, value: T) -> bool
pub fn contains(&self, value: T) -> bool
Returns true if the arena contains the specified value.
Sourcepub fn extend_from_slice(&mut self, items: &[T])
pub fn extend_from_slice(&mut self, items: &[T])
Extends the arena by cloning elements from a slice.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Arena<T>
impl<T> RefUnwindSafe for Arena<T>where
T: RefUnwindSafe,
impl<T> Send for Arena<T>where
T: Send,
impl<T> Sync for Arena<T>where
T: Sync,
impl<T> Unpin for Arena<T>where
T: Unpin,
impl<T> UnsafeUnpin for Arena<T>
impl<T> UnwindSafe for Arena<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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more