pub trait BitValue: Copy {
// Required methods
fn encode_bits(self, width: usize) -> Result<u128>;
fn decode_bits(value: u128, width: usize) -> Result<Self>;
}Available on crate feature
bit-packing only.Expand description
Conversion contract for fields with an explicit #[bits = N] width.
Required Methods§
Sourcefn encode_bits(self, width: usize) -> Result<u128>
fn encode_bits(self, width: usize) -> Result<u128>
Encodes and validates this value against width.
Sourcefn decode_bits(value: u128, width: usize) -> Result<Self>
fn decode_bits(value: u128, width: usize) -> Result<Self>
Decodes and validates this value from width bits.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".