pub struct SliceArena<T = u8> { /* private fields */ }Expand description
Thread-safe memory arena.
Implementations§
Source§impl<T: Clone> SliceArena<T>
impl<T: Clone> SliceArena<T>
Sourcepub fn new() -> Self
pub fn new() -> Self
New arena with ~64KB of initial capacity (which will grow exponentially as needed).
It works with any cloneable element type, but SliceArena<u8> is the default (it’s like Vec<u8>).
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
New arena with memory reserved for the initial number of elements.
Arena grows expomnentially, so once this capacity is exhausted, a double of that size will be allocated.
Capacity should be much much larger than sizes of slices pushed. Pushing a slice larger than the capacity leaves previous capacity unused.
Auto Trait Implementations§
impl<T = u8> !Freeze for SliceArena<T>
impl<T> RefUnwindSafe for SliceArena<T>
impl<T> Send for SliceArena<T>where
T: Send,
impl<T> Sync for SliceArena<T>where
T: Send,
impl<T> Unpin for SliceArena<T>where
T: Unpin,
impl<T> UnwindSafe for SliceArena<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