Trait bit_struct::BitStruct

source ·
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§

source

type Kind

The underlying type used to store the bit struct

Required Methods§

source

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.

Implementors§