Module bitvec::view[][src]

BitSlice view adapters for memory regions.

The &BitSlice type is a referential view over existing memory. The inherent constructor functions are awkward to call, as they require function syntax rather than method syntax, and must provide a token for the memory type argument even though this is informed by the already-existing reference being used.

This module provides an extension trait, BitView, which provides methods on many memory types (all BitRegister integers, and slices and arrays of them) to construct BitSlice over those values.

In addition, the traits AsBits and AsBitsMut are analogues of AsRef and AsMut, respectively. These traits have a blanket implementation for all A: As{Ref,Mut}<[T: BitRegister]>, so that any type that implements a view to a suitable memory region automatically implements a view to that region’s bits.

These traits are distinct because BitView combines the im/mutable view functions into one trait, and can provide specialized implementations with a slight performance increase over the generic, but AsBits{,Mut} can fit in the generic type system of any library without undue effort.

Traits

AsBits

Views a region as an immutable BitSlice only.

AsBitsMut

Views a region as a mutable BitSlice.

BitView

Creates a BitSlice view over some type that supports it.