fielder
fielder provides a single macro (bitfield) which (like
bitflags) allows for defining complex structures
packed into only a few bytes. These structures differ from those generated by similar crates by
allowing significantly more complex fields to be defined. These fields can span multiple bits,
can act as a simple counter, and behave like you'd expect. Everything is no_std and no_alloc,
making fielder a perfect fit for embedded protocols.
Example
use bitfield;
bitfield!
// Fields are constructed from an integer via `from_bits`.
let field = from_bits;
// The first bit (FirstFlag) isn't set.
assert!;
// The second and third bits are set, so FourthField is set.
assert!;
// Importantly, even though its bit is set, SecondField isn't set.
assert!;
// The current literal value of CounterField can be read.
assert_eq!;