pub struct BumpAllocator { /* private fields */ }
Implementations§
Source§impl BumpAllocator
impl BumpAllocator
pub fn new(ptr: NonNull<u8>, size: usize) -> Self
pub fn start_address(&self) -> usize
pub fn used_space(&self) -> usize
pub fn free_space(&self) -> usize
pub fn total_space(&self) -> usize
Trait Implementations§
Source§impl BaseAllocator for BumpAllocator
impl BaseAllocator for BumpAllocator
Source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocationError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocationError>
Allocates a memory chunk with the properties provided in layout and either
returns a slice or an allocation error on failure.
Source§unsafe fn deallocate(&self, _ptr: NonNull<u8>, _layout: Layout)
unsafe fn deallocate(&self, _ptr: NonNull<u8>, _layout: Layout)
Releases an previously allocated chunk of memory. Read more
Source§fn allocate_zeroed(
&self,
layout: Layout,
) -> Result<NonNull<[u8]>, AllocationError>
fn allocate_zeroed( &self, layout: Layout, ) -> Result<NonNull<[u8]>, AllocationError>
Allocates a memory chunk with the properties provided in layout and zeroes the memory
On success it returns a slice or an allocation error on failure.
Source§impl Debug for BumpAllocator
impl Debug for BumpAllocator
Auto Trait Implementations§
impl !Freeze for BumpAllocator
impl RefUnwindSafe for BumpAllocator
impl Send for BumpAllocator
impl Sync for BumpAllocator
impl Unpin 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