Attribute Macro binary_serde_macros::binary_serde_bitfield
source · #[binary_serde_bitfield]Expand description
an attribute for defining bitfields and implementing the BinarySerde trait for them.
you should add the #[bits(...)] attribute on each of the fields to specify their bit length.
the fields are treated as lsb first.
you can use any type that implements the BinarySerde trait as the type of a field in the bitfield.
Example
#[derive(Debug, Default, PartialEq, Eq)]
#[binary_serde_bitfield]
struct Elf32RelocationInfo {
#[bits(8)]
ty: u8,
#[bits(24)]
symbol_index: u32,
}