Trait iobuf::Allocator
[−]
[src]
pub trait Allocator: Sync + Send { fn allocate(&self, len: usize, align: usize) -> *mut u8; fn deallocate(&self, ptr: NonZero<*mut u8>, len: usize, align: usize); }
Used to provide custom memory to Iobufs, instead of just using the heap.
Required Methods
fn allocate(&self, len: usize, align: usize) -> *mut u8
Allocates len
bytes of memory, with an alignment of align
.
fn deallocate(&self, ptr: NonZero<*mut u8>, len: usize, align: usize)
Deallocates memory allocated by allocate
.