pub struct AllocOnce<T> { /* private fields */ }Expand description
Owns a bump arena and the single value allocated inside it.
Access the value through Deref/DerefMut (&*guard / &mut *guard). When
the guard is dropped it runs the value’s destructor and then frees the arena —
unlike a raw bumpalo::Bump::alloc, whose values are never dropped.
Construct one with the alloc_once! macro rather than by hand.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for AllocOnce<T>
impl<T> !RefUnwindSafe for AllocOnce<T>
impl<T> !Send for AllocOnce<T>
impl<T> !Sync for AllocOnce<T>
impl<T> !UnwindSafe for AllocOnce<T>
impl<T> Unpin for AllocOnce<T>
impl<T> UnsafeUnpin for AllocOnce<T>
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