Trait drone_core::heap::Allocator [] [src]

pub trait Allocator {
    const POOL_COUNT: usize;

    unsafe fn get_pool_unchecked<I>(&self, index: I) -> &I::Output
    where
        I: SliceIndex<[Pool]>
;
unsafe fn get_pool_unchecked_mut<I>(&mut self, index: I) -> &mut I::Output
    where
        I: SliceIndex<[Pool]>
; unsafe fn init(&mut self, start: &mut usize) { ... }
fn binary_search<T: Fits>(&self, value: T) -> usize { ... } }

A lock-free allocator that composes multiple memory pools.

An Allocator maintains a sort-order of its pools, so they can be effectively accessed with binary_search.

Associated Constants

Number of memory pools.

Required Methods

Returns a reference to a pool or subslice, without doing bounds checking.

Returns a mutable reference to a pool or subslice, without doing bounds checking.

Provided Methods

Initializes the pools with start address.

Safety

  • Must be called no more than once.
  • Must be called before using the allocator.
  • start must be word-aligned.

Binary searches the pools for a least-sized one which fits value.

Implementors