Trait heapless::pool::boxed::BoxPool

source ·
pub trait BoxPool: Sized {
    type Data: 'static;

    // Provided methods
    fn alloc(value: Self::Data) -> Result<Box<Self>, Self::Data> { ... }
    fn manage(block: &'static mut BoxBlock<Self::Data>) { ... }
}
Available on arm_llsc or x86 only.
Expand description

A singleton that manages pool::boxed::Box-es

Usage

Do not implement this trait yourself; instead use the box_pool! macro to create a type that implements this trait.

Semver guarantees

Implementing this trait is exempt from semver guarantees. i.e. a new patch release is allowed to break downstream BoxPool implementations.

Using the trait, e.g. in generic code, does fall under semver guarantees.

Required Associated Types§

source

type Data: 'static

The data type managed by the memory pool

Provided Methods§

source

fn alloc(value: Self::Data) -> Result<Box<Self>, Self::Data>

Allocate a new Box initialized to the given value

manage should be called at least once before calling alloc

Errors

The Error variant is returned when the memory pool has run out of memory blocks

source

fn manage(block: &'static mut BoxBlock<Self::Data>)

Add a statically allocated memory block to the memory pool

Object Safety§

This trait is not object safe.

Implementors§