Slices preallocated memory pool into contiguous blocks of different types.
// Here xs, ys and zs are using memory allocated in `pool`.
struct Something {
pool: JointPool,
xs: JointSlice<u32>,
ys: JointSlice<Filler>,
zs: JointSlice<Enum>,
}
impl Something {
fn new() -> Self {
// name: type = number of elements to allocate
let p = allocate_joint! {
xs: u32 = 3, ys: Filler = 2, zs: Enum = 1
};
Self {
pool: p.pool,
xs: p.xs,
ys: p.ys,
zs: p.zs,
}
}
}