Crate bool_to_bitflags

source ·
Expand description

§bool-to-bitflags

A struct attribute macro to pack structs with multiple boolean fields into efficent byte packing.

This macro will make struct fields of type bool and Option<bool> be packed into a field called __generated_flags.

This field is responsible for storing the packed bits, and should not be messed with manually, other than to initialize as all-false with {StructName}GeneratedFlags::empty() or all-true with {StructName}GeneratedFlags::all().

§Arguments

Argument NameTypeDefault ValueDescription
getter_prefixStringThe prefix before getter names
setter_prefixStringset_The prefix before setter names
private_gettersboolField VisibilityIf true, getters are forced to be crate-private
private_settersboolField VisibilityIf true, setters are forced to be crate-private
document_settersboolfalseIf true, field documentation is used for setters, instead of getters
owning_settersboolfalseIf true, setters take self and return self instead of taking &mut self

§MSRV

The Minimum Supported Rust Version of this crate is 1.65.

It is considered a breaking change to raise this requirement.

Attribute Macros§