Struct static_alloc::unsync::Chain
source · pub struct Chain { /* private fields */ }
Expand description
A Chain
is a simple bump allocator, that draws
it’s memory from another allocator. Chain allocators
can be chained together using Chain::chain
.
Implementations§
source§impl Chain
impl Chain
sourcepub fn new(size: usize) -> Result<Self, TryNewError>
pub fn new(size: usize) -> Result<Self, TryNewError>
Creates a new Chain
that has a capacity of size
bytes.
sourcepub fn bump_box<'bump, T: 'bump>(
&'bump self
) -> Result<LeakBox<'bump, MaybeUninit<T>>, Failure>
pub fn bump_box<'bump, T: 'bump>( &'bump self ) -> Result<LeakBox<'bump, MaybeUninit<T>>, Failure>
Attempts to allocate elem
within the allocator.
sourcepub fn chain(&self, new: Chain)
pub fn chain(&self, new: Chain)
Chains self
together with new
.
Following allocations will first be allocated from new
.
Note that this will drop all but the first link from new
.
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the capacity of this Chain
.
This is how many bytes in total can
be allocated within this Chain
.
sourcepub fn remaining_capacity(&self) -> usize
pub fn remaining_capacity(&self) -> usize
Returns the remaining capacity of this Chain
.
This is how many more bytes can be allocated
within this Chain
.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Chain
impl !Send for Chain
impl !Sync for Chain
impl Unpin for Chain
impl !UnwindSafe for Chain
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