pub trait ByteAllocator: BaseAllocator {
    // Required methods
    fn alloc(&mut self, layout: Layout) -> AllocResult<NonNull<u8>>;
    fn dealloc(&mut self, pos: NonNull<u8>, layout: Layout);
    fn total_bytes(&self) -> usize;
    fn used_bytes(&self) -> usize;
    fn available_bytes(&self) -> usize;
}
Expand description

Byte-granularity allocator.

Required Methods§

source

fn alloc(&mut self, layout: Layout) -> AllocResult<NonNull<u8>>

Allocate memory with the given size (in bytes) and alignment.

source

fn dealloc(&mut self, pos: NonNull<u8>, layout: Layout)

Deallocate memory at the given position, size, and alignment.

source

fn total_bytes(&self) -> usize

Returns total memory size in bytes.

source

fn used_bytes(&self) -> usize

Returns allocated memory size in bytes.

source

fn available_bytes(&self) -> usize

Returns available memory size in bytes.

Implementors§