[−][src]Module bitvec::slice
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
slicecontains new APIs that have no counterpart in[T] slice/apicontains reïmplementations of the[T]inherent methodsslice/iterimplements all of the iteration capabilityslice/opsimplements the traits incore::opsslice/proxyimplements the proxy reference used in place of&mut boolslice/traitsimplements all other traits not incore::ops- lastly,
slice/testscontains all the unit tests.
Structs
| BitMut | Proxy reference type, equivalent to |
| BitSlice | A slice of individual bits, anywhere in memory. |
| Chunks | An iterator over a bit slice in (non-overlapping) chunks ( |
| ChunksExact | An iterator over a bit slice in (non-overlapping) chunks ( |
| ChunksExactMut | An iterator over a bit slice in (non-overlapping) mutable chunks
( |
| ChunksMut | An iterator over a bit slice in (non-overlapping) mutable chunks
( |
| Iter | Immutable slice iterator |
| IterMut | Mutable bit slice iterator. |
| RChunks | An iterator over a bit slice in (non-overlapping) chunks ( |
| RChunksExact | An iterator over a bit slice in (non-overlapping) chunks ( |
| RChunksExactMut | An iterator over a bit slice in (non-overlapping) mutable chunks
( |
| RChunksMut | An iterator over a slice in (non-overlapping) mutable chunks ( |
| RSplit | An iterator over subslices separated by bits that match a predicate function, starting from the end of the slice. |
| RSplitMut | An iterator over subslices separated by bits that match a predicate function, starting from the end of the slice. |
| 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 slice. |
| 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 slice. |
| Split | An iterator over subslices separated by bits that match a predicate function. |
| SplitMut | An iterator over the mutable subslices of the slice 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
| bits_from_raw_parts⚠ | Constructs a |
| bits_from_raw_parts_mut⚠ | Constructs a |
| from_mut | Converts a reference to |
| from_raw_parts⚠ | Forms a bitslice from a pointer and a length. |
| from_raw_parts_mut⚠ | Performs the same functionality as |
| from_ref | Converts a reference to |