pub trait BitStruct<const ALWAYS_VALID: bool> {
type Kind;
// Required method
unsafe fn from_unchecked(value: Self::Kind) -> Self;
}
Expand description
A trait that all bit structs implement
See the bit_struct
macro for more details.
Required Associated Types§
Required Methods§
Sourceunsafe fn from_unchecked(value: Self::Kind) -> Self
unsafe fn from_unchecked(value: Self::Kind) -> Self
Produce a bit struct from the given underlying storage, without checking for validity.
§Safety
The caller is responsible for verifying that this value is a valid value for the bit struct.
If this is guaranteed to be safe (i.e. all possibly inputs for value
are valid), then the bit struct will also implement BitStructExt
which has the BitStructExt::exact_from
method, that you should
use instead.
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.