Trait constriction::BitArray[][src]

pub unsafe trait BitArray: PrimInt + Unsigned + WrappingAdd + WrappingSub + WrappingMul + LowerHex + UpperHex + Binary + Default + Copy + Display + Debug + Eq + Hash + 'static {
    type NonZero: NonZeroBitArray<Base = Self>;

    const BITS: usize;
    fn into_nonzero(self) -> Option<Self::NonZero> { ... }
unsafe fn into_nonzero_unchecked(self) -> Self::NonZero { ... } }
Expand description

A trait for bit strings of fixed (and usually small) length.

Short fixed-length bit strings are fundamental building blocks of efficient entropy coding algorithms. They are currently used for the following purposes:

This trait is implemented on all primitive unsigned integer types. It is not recommended to implement this trait for custom types since coders will assume, for performance considerations, that BitArrays can be represented and manipulated efficiently in hardware.

Safety

This trait is marked unsafe so that entropy coders may rely on the assumption that all BitArrays have precisely the same behavior as builtin unsigned integer types, and that BitArray::BITS has the correct value.

Associated Types

Associated Constants

The (fixed) length of the BitArray in bits.

Defaults to 8 * core::mem::size_of::<Self>(), which is suitable for all primitive unsigned integers.

This could arguably be called LEN instead, but that may be confusing since “lengths” are typically not measured in bits in the Rust ecosystem.

Provided methods

Safety

The provided value must be nonzero.

Implementations on Foreign Types

Implementors