pub trait BitAmount: Copy {
// Required methods
fn bits(self) -> u32;
fn bytes(self) -> u32;
}Expand description
A typed bit/byte amount for positioning directives — 4.bits(), 3.bytes() —
resolving to a bit count. Bring it in with use bnb::prelude::*.
§Examples
use bnb::prelude::*;
assert_eq!(4u32.bits(), 4);
assert_eq!(3u32.bytes(), 24);Used by the positioning directives, e.g. #[br(pad_before = 2u32.bytes())] — see
guide::directives.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".