Struct byte_slab::byte_slab::BSlab [−][src]
Expand description
A slab of byte-array elements
A BSlab is intended to be allocated as a static item. The const constructor,
returns an item containing only zeros, meaning that it will be placed in the
.bss
section, meaning it will not use up flash memory space.
A BSlab has two generic parameters, both usize
s:
N
: The number of allocatable elements contained by the SlabSZ
: The size (in bytes) of each element
For example, a BSlab<8, 128>
would contain eight, 128-byte elements. Therefore
it would have a total storage space of 1024 bytes.
Implementations
Storage of a slab of runtime-allocatable byte chunks
Create a new BSlab
in a constant context.
NOTE: The BSlab
MUST be initialized with a call to BSlab::init()
before
usage, or all allocations will fail!
Allocate a new Box of SZ
.
This function will return None
if the buffer has not been initialized,
or if there are no pages available.