pub struct Arena<T> { /* private fields */ }Expand description
An owning arena for stable references.
Values stay at their allocated addresses until the arena is dropped or reset. Their destructors run at that boundary, including destructors of owned AST vectors and strings.
Implementations§
Source§impl<T> Arena<T>
impl<T> Arena<T>
Sourcepub fn alloc(&self, value: T) -> &T
pub fn alloc(&self, value: T) -> &T
Allocates a value and returns a reference valid for the arena’s lifetime.
Sourcepub fn alloc_slice<I>(&self, items: I) -> &[T]
pub fn alloc_slice<I>(&self, items: I) -> &[T]
Allocates a contiguous slice from an iterator.
The iterator must implement ExactSizeIterator so its allocation can be reserved up front. It may itself allocate from this arena.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Arena<T>
impl<T> !RefUnwindSafe for Arena<T>
impl<T> Send for Arena<T>where
T: Send,
impl<T> !Sync for Arena<T>
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