Crate const_bitfield
source ·Expand description
This crate provides macros to generate bitfield-like structs with const support.
Due to offering const support, this library requires the usage of Rust nightly. Additionally, you must add the following feature flags to your crate root:
#![feature(const_convert)] // optional, when using from/into conversion
#![feature(const_mut_refs)] // always required
#![feature(const_trait_impl)] // always required
This is required as some required features are currently gated behind these flags. Further documentation about usage can be found in the individual macros.
Macros
This macro defines a new bitfield-like
struct
backed by a single uint-like type.
A variable amount of getters and or setters can be specified on a bitwise level.
Every operation automatically ensures that no bounds are being violated.Traits
A trait to retrieve a single bit as a boolean.
A trait to set a single bit as a boolean.
A trait to retrieve a range of bits as type
V
.A trait to set a range of bits with the type
V
.