pub struct Arena { /* private fields */ }Expand description
Bump allocator arena
Implementations§
Source§impl Arena
impl Arena
Sourcepub fn with_capacity(capacity: usize) -> Result<Self>
pub fn with_capacity(capacity: usize) -> Result<Self>
Create a new arena with specified capacity
Sourcepub fn with_capacity_and_alignment(
capacity: usize,
alignment: usize,
) -> Result<Self>
pub fn with_capacity_and_alignment( capacity: usize, alignment: usize, ) -> Result<Self>
Create a new arena with specified capacity and alignment
Sourcepub fn allocate_aligned(
&self,
size: usize,
alignment: usize,
) -> Result<NonNull<u8>>
pub fn allocate_aligned( &self, size: usize, alignment: usize, ) -> Result<NonNull<u8>>
Allocate aligned memory from the arena
Sourcepub fn is_exhausted(&self) -> bool
pub fn is_exhausted(&self) -> bool
Check if arena is exhausted
Sourcepub fn stats(&self) -> Arc<ArenaStats>
pub fn stats(&self) -> Arc<ArenaStats>
Get statistics
Sourcepub fn allocate_slice<T>(&self, count: usize) -> Result<&mut [T]>
pub fn allocate_slice<T>(&self, count: usize) -> Result<&mut [T]>
Allocate a slice of values
Sourcepub fn allocate_value<T>(&self, value: T) -> Result<&mut T>
pub fn allocate_value<T>(&self, value: T) -> Result<&mut T>
Allocate and initialize a value
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Arena
impl RefUnwindSafe for Arena
impl Unpin for Arena
impl UnsafeUnpin 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