[−][src]Trait drone_core::heap::Allocator
Allocator for a generic memory pools layout.
The trait is supposed to be implemented for an array of pools.
heap
macro should be used to generate the concrete type and
the implementation.
Associated Constants
const POOL_COUNT: usize
The total number of memory pools.
Required methods
unsafe fn get_pool_unchecked<I>(&self, index: I) -> &I::Output where
I: SliceIndex<[Pool]>,
I: SliceIndex<[Pool]>,
Returns a reference to a pool or subslice, without doing bounds checking.
Safety
Calling this method with an out-of-bounds index is Undefined Behavior.
unsafe fn get_pool_unchecked_mut<I>(&mut self, index: I) -> &mut I::Output where
I: SliceIndex<[Pool]>,
I: SliceIndex<[Pool]>,
Returns a mutable reference to a pool or subslice, without doing bounds checking.
Safety
Calling this method with an out-of-bounds index is Undefined Behavior.
Provided methods
fn alloc_hook(_layout: Layout, _pool: &Pool)
Empty allocation hook. Can be re-defined by the implementation.
fn dealloc_hook(_layout: Layout, _pool: &Pool)
Empty deallocation hook. Can be re-defined by the implementation.
fn grow_in_place_hook(_layout: Layout, _new_size: usize)
Empty growing in place hook. Can be re-defined by the implementation.
fn shrink_in_place_hook(_layout: Layout, _new_size: usize)
Empty shrinking in place hook. Can be re-defined by the implementation.
fn binary_search<T: Fits>(&self, value: T) -> usize
Does a binary search for the pool with the smallest block size to fit
value
.