bern-kernel 0.2.5

Preemptive real-time kernel for microcontrollers.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::mem::boxed::Box;

/// Memory allocation errors.
#[derive(Debug, Eq, PartialEq)]
pub enum Error {
    /// No more memory available for allocator
    OutOfMemory,
    /// An unknown error occured
    Unknown,
}

/// Pool based allocators.
pub trait PoolAllocator<T> {
    /// Allocate and move an element to a pool and return box to value if
    /// operation succeeded.
    fn insert(&self, element: T) -> Result<Box<T>, Error>;
    // todo: drop
}