Module bitvec::slice [−][src]
A dynamically-sized view into individual bits of a memory region.
You can read the language’s slice
module documentation here.
This module defines the BitSlice
region, and all of its associated support
code.
BitSlice
is the primary working type of this crate. It is a wrapper type
over [T]
which enables you to view, manipulate, and take the address of
individual bits in memory. It behaves in every possible respect exactly like an
ordinary slice: it is dynamically-sized, and must be held by &
or &mut
reference, just like [T]
, and implements every inherent method and trait that
[T]
does, to the absolute limits of what Rust permits.
The key to BitSlice
’s powerful capability is that references to it use a
special encoding that store, in addition to the address of the base element and
the bit length, the index of the starting bit in the base element. This custom
reference encoding has some costs in what APIs are possible – for instance, Rust
forbids it from supporting &mut BitSlice[index] = bool
write indexing – but in
exchange, enables it to be far more capable than any other bit-slice crate in
existence.
Because of the volume of code that must be written to match the [T]
standard
API, this module is organized very differently than the slice implementation in
the core
and std
distribution libraries.
- the root module
slice
contains new APIs that have no counterpart in[T]
slice/api
contains reïmplementations of the[T]
inherent methodsslice/iter
implements all of the iteration capabilityslice/ops
implements the traits incore::ops
slice/proxy
implements the proxy reference used in place of&mut bool
slice/traits
implements all other traits not incore::ops
- lastly,
slice/tests
contains all the unit tests.
Structs
BitSlice | A slice of individual bits, anywhere in memory. |
Chunks | An iterator over a |
ChunksExact | An iterator over a |
ChunksExactMut | An iterator over a |
ChunksMut | An iterator over a |
Iter | Immutable |
IterMut | Mutable |
IterOnes | Enumerates bits in a |
IterZeros | Enumerates bits in a |
RChunks | An iterator over a |
RChunksExact | An iterator over a |
RChunksExactMut | An iterator over a |
RChunksMut | An iterator over a |
RSplit | An iterator over subslices separated by bits that match a predicate
function, starting from the end of the |
RSplitMut | An iterator over subslices separated by bits that match a predicate
function, starting from the end of the |
RSplitN | An iterator over subslices separated by bits that match a predicate
function, limited to a given number of splits, starting from the end of the
|
RSplitNMut | An iterator over subslices separated by bits that match a predicate
function, limited to a given number of splits, starting from the end of the
|
Split | An iterator over subslices separated by bits that match a predicate function. |
SplitMut | An iterator over the mutable subslices which are separated by bits that
match |
SplitN | An iterator over subslices separated by bits that match a predicate function, limited to a given number of splits. |
SplitNMut | An iterator over subslices separated by bits that match a predicate function, limited to a given number of splits. |
Windows | An iterator over overlapping subslices of length |
Traits
BitSliceIndex | A helper trait used for indexing operations. |
Functions
from_mut | Converts a reference to |
from_raw_parts⚠ | Forms a bit-slice from a bit-pointer and a length. |
from_raw_parts_mut⚠ | Performs the same functionality as |
from_raw_parts_unchecked⚠ | Performs the same functionality as |
from_raw_parts_unchecked_mut⚠ | Performs the same functionality as |
from_ref | Converts a reference to |