Struct byte_slab::byte_slab::BSlab[][src]

pub struct BSlab<const N: usize, const SZ: usize> { /* fields omitted */ }
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 usizes:

  • N: The number of allocatable elements contained by the Slab
  • SZ: 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!

Is the buffer initialized?

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.

Initialize the buffer.

This function will fail if the BSlab has already been initialized, OR if it is already in-process of being initialized (e.g. in a multithreaded context).

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.