Derive Macro bondrewd_derive::Bitfields[][src]

#[derive(Bitfields)]
{
    // Attributes available to this derive:
    #[bondrewd]
}
Expand description

Generates an implementation of the bondrewd::Bitfield trait, as well as peek and set functions for direct sized u8 arrays access.

Struct Derive Tasks

  • Little Endian primitives
    • Impl peek_{field} and set_{field} functions.
    • Impl into_bytes.
    • Impl from_bytes.
    • Impl peek_slice_{field} and set_slice_{field} functions.
  • Big Endian primitives
    • Impl peek_{field} and set_{field} functions.
    • Impl into_bytes.
    • Impl from_bytes.
    • Impl peek_slice_{field} and set_slice_{field} functions.
  • Struct
    • Impl peek_{field} and set_{field} functions.
    • Impl into_bytes.
    • Impl from_bytes.
    • Impl peek_slice_{field} and set_slice_{field} functions.
  • Enum
    • Impl peek_{field} and set_{field} functions.
    • Impl into_bytes.
    • Impl from_bytes.
    • Impl peek_slice_{field} and set_slice_{field} functions.
  • Element Arrays
    • Impl peek_{field} and set_{field} functions.
    • Impl into_bytes.
    • Impl from_bytes.
    • Impl peek_slice_{field} and set_slice_{field} functions.
  • Block Arrays
    • Impl peek_{field} and set_{field} functions.
    • Impl into_bytes.
    • Impl from_bytes.
    • Impl peek_slice_{field} and set_slice_{field} functions.
    • use this array type automatically if no attributes are provided.
  • bit size enforcement as an option to ensure proper struct sizing
    • full bytes attribute (BIT_SIZE % 8 == 0)
    • total bit/bytes length enforcement by a specified amount of bits or bytes.
  • read_direction ( the bit order is reversed with no runtime cost)
  • flip (flip the entire byte order with no runtime cost)
  • reserve fields which don’t get read or written in into or from bytes functions.
  • primitives should exclude usize and isize due to ambiguous sizing