pub struct GrowingArena { /* private fields */ }Expand description
Growing arena that can expand its capacity
Implementations§
Source§impl GrowingArena
impl GrowingArena
pub fn new( base_ptr: NonNull<u8>, initial_size: usize, growth_strategy: GrowthStrategy, ) -> Result<Self, ArenaError>
pub fn with_external_allocator( self, allocator: Box<dyn ExternalAllocator>, ) -> Self
Sourcepub fn allocate(&mut self, size: usize) -> Result<NonNull<u8>, ArenaError>
pub fn allocate(&mut self, size: usize) -> Result<NonNull<u8>, ArenaError>
Allocate with automatic growth
Sourcepub fn contains_pointer(&self, ptr: NonNull<u8>) -> bool
pub fn contains_pointer(&self, ptr: NonNull<u8>) -> bool
Check if pointer belongs to any arena
Sourcepub fn get_total_usage(&self) -> GrowingArenaUsage
pub fn get_total_usage(&self) -> GrowingArenaUsage
Get total usage across all arenas
Auto Trait Implementations§
impl Freeze for GrowingArena
impl !RefUnwindSafe for GrowingArena
impl !Send for GrowingArena
impl !Sync for GrowingArena
impl Unpin for GrowingArena
impl UnsafeUnpin for GrowingArena
impl !UnwindSafe for GrowingArena
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more