pub unsafe trait BitCount {
    const COUNT: usize;
}Expand description
A trait which defines how many bits are needed to store a struct.
§Safety
Define Num as {i,u}{8,16,32,64,128}.
- when calling core::mem::transmuteonSelf, only bits [0, COUNT) can be non-zero
- TryFrom<Num>produces- Some(x)<=>- core::mem::transmute(num)produces a valid Self(x)
- TryFrom<Num>produces- None<=>- core::mem::transmute(num)produces an invalid state for Self
Required Associated Constants§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.