#[derive(BitwisePackable)]
{
// Attributes available to this derive:
#[rbitpack]
}
Expand description
Macro to derive bitwise packing and unpacking methods for a struct with boolean fields.
§Attributes
rbitpack(size = "i32", overflow = true)
: Configures the packing options.size
: Specifies the type of integer to use for packing ("i8"
,"i16"
,"i32"
,"i64"
, or"auto"
).overflow
: A boolean indicating whether to allow packing more boolean fields than the bit capacity of the chosen integer type (default isfalse
).
§Example
use rbitpack::BitwisePackable;
#[derive(BitwisePackable)]
#[rbitpack(size = "i32", overflow = true)]
struct MyStruct {
field1: bool,
field2: bool,
field3: bool,
}