pub struct Arena { /* private fields */ }
Expand description
A bump allocation arena.
§Examples
let mut arena = Arena::new(1000);
let mut buffers = Vec::new();
for _ in 0..10 {
// All 10 buffers will be allocated in the same chunk.
let mut buf = arena.alloc(100);
buffers.push(buf);
}
// The buffers may outlive the arena they were allocated with.
drop(arena);
buffers[0][0] = 1;
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Arena
impl RefUnwindSafe for Arena
impl Send for Arena
impl Sync for Arena
impl Unpin for Arena
impl UnwindSafe for Arena
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