without-alloc
Dynamic data structures that do not require a global allocator.
Usage
This allows creating dynamic and recursive data structures without dynamic
allocations. The example below makes use of the static-alloc
crate to build a
list with static lifetime based on dynamic data. As local memory pools for
fixed capacity FixedVec
:
use Bump;
use ;
let mut pool: = uninit;
// Allocate a vector with capacity of 16 from the slab.
let mut vector = pool.fixed_vec.unwrap;
let mut num = 0;
// Push mutable ref, not `'static`, `Copy` nor `Clone`!
vector.push;
*vector = 42;
drop;
assert_eq!;
This might be handy if you want to chain boot another kernel and pass it a linked list describing the platform.
use Bump;
use ;
static SLAB: = uninit;
let base = SLAB.boxed.unwrap;
let one = SLAB.boxed.unwrap;
let two = SLAB.boxed.unwrap;