pub trait Allocator {
    // Required methods
    fn alloc(&mut self, size: usize) -> RawMemPtr;
    fn dealloc(&mut self, ptr: RawMemPtr);
    fn realloc(&mut self, ptr: RawMemPtr, new_size: usize) -> RawMemPtr;
    fn usable_size(ptr: RawMemPtr) -> usize
       where Self: Sized;
}
Available on crate feature allocator only.
Expand description

The allocator interface

Required Methods§

source

fn alloc(&mut self, size: usize) -> RawMemPtr

Allocate new memory

source

fn dealloc(&mut self, ptr: RawMemPtr)

De-allocate previously allocated memory

source

fn realloc(&mut self, ptr: RawMemPtr, new_size: usize) -> RawMemPtr

Re-allocate previously allocated memory

source

fn usable_size(ptr: RawMemPtr) -> usize
where Self: Sized,

Get usable size of allocated memory region

Implementors§