Trait allocator::ByteAllocator
source · pub trait ByteAllocator: BaseAllocator {
// Required methods
fn alloc(&mut self, size: usize, align_pow2: usize) -> AllocResult<usize>;
fn dealloc(&mut self, pos: usize, size: usize, align_pow2: usize);
fn total_bytes(&self) -> usize;
fn used_bytes(&self) -> usize;
fn available_bytes(&self) -> usize;
}
Expand description
Byte-granularity allocator.
Required Methods§
sourcefn alloc(&mut self, size: usize, align_pow2: usize) -> AllocResult<usize>
fn alloc(&mut self, size: usize, align_pow2: usize) -> AllocResult<usize>
Allocate memory with the given size (in bytes) and alignment.
sourcefn dealloc(&mut self, pos: usize, size: usize, align_pow2: usize)
fn dealloc(&mut self, pos: usize, size: usize, align_pow2: usize)
Deallocate memory at the given position, size, and alignment.
sourcefn total_bytes(&self) -> usize
fn total_bytes(&self) -> usize
Returns total memory size in bytes.
sourcefn used_bytes(&self) -> usize
fn used_bytes(&self) -> usize
Returns allocated memory size in bytes.
sourcefn available_bytes(&self) -> usize
fn available_bytes(&self) -> usize
Returns available memory size in bytes.