pub struct BumpAllocator { /* private fields */ }Expand description
An AllocatorCore that pre-allocates a large buffer of memory and then satisfies
allocation requests from that buffer.
Note that the memory for allocations made through this allocator and its clones will not be freed until all clones have been dropped.
Memory allocation through this page is thread safe.
Implementations§
Source§impl BumpAllocator
impl BumpAllocator
Sourcepub fn new(
capacity: usize,
alignment: PowerOfTwo,
) -> Result<Self, AllocatorError>
pub fn new( capacity: usize, alignment: PowerOfTwo, ) -> Result<Self, AllocatorError>
Construct a new BumpAllocator with room for capacity bytes. The base pointer
for the allocator will be aligned to at least alignment bytes.
Returns an error if alignment is not a power of two or if an error occurs during
memory allocation.
Trait Implementations§
Source§impl AllocatorCore for BumpAllocator
impl AllocatorCore for BumpAllocator
Source§impl Clone for BumpAllocator
impl Clone for BumpAllocator
Source§fn clone(&self) -> BumpAllocator
fn clone(&self) -> BumpAllocator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BumpAllocator
impl RefUnwindSafe for BumpAllocator
impl Send for BumpAllocator
impl Sync for BumpAllocator
impl Unpin for BumpAllocator
impl UnsafeUnpin for BumpAllocator
impl UnwindSafe for BumpAllocator
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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