pub struct ArenaBox<T> { /* private fields */ }Expand description
A pointer to T in the arena
ArenaBox implements DerefMut so it is directly mutable
(without mutex or other synchronization methods).
It is not clonable and can be sent to others threads.
§Deref & DerefMut behavior
ArenaBox<T> automatically dereferences to T, so you can call
T’s methods on a value of type ArenaBox<T>.
let arena = SharedArena::new();
let mut my_opt: ArenaBox<Option<i32>> = arena.alloc(Some(10));
assert!(my_opt.is_some());
assert_eq!(my_opt.take(), Some(10));
assert!(my_opt.is_none());Trait Implementations§
Source§impl<T> Drop for ArenaBox<T>
Drop the ArenaBox
impl<T> Drop for ArenaBox<T>
Drop the ArenaBox
The value pointed by this ArenaBox is also dropped
impl<T: Send> Send for ArenaBox<T>
impl<T: Send + Sync> Sync for ArenaBox<T>
Auto Trait Implementations§
impl<T> Freeze for ArenaBox<T>
impl<T> !RefUnwindSafe for ArenaBox<T>
impl<T> Unpin for ArenaBox<T>
impl<T> !UnwindSafe for ArenaBox<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