Trait bit_struct::BitCount[][src]

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::transmute on Self, only bits [0, COUNT) can be non-zero
  • TryFrom produces Some(x) <=> core::mem::transmute(num) produces a valid Self(x)
  • TryFrom produces None <=> core::mem::transmute(num) produces an invalid state for Self

Associated Constants

Implementations on Foreign Types

Implementors