| 1 |
# Exclusive Bit-Slice Reverse Exact Chunking |
| 2 |
|
| 3 |
This iterator yields successive non-overlapping mutable chunks of a bit-slice. |
| 4 |
Chunking advances one sub-slice at a time, starting at the end of the bit-slice. |
| 5 |
|
| 6 |
If the original bit-slice’s length is not evenly divided by the chunk width, |
| 7 |
then the leftover segment at the front is not iterated, but can be accessed with |
| 8 |
the [`.into_remainder()`] or [`.take_remainder()`] methods. |
| 9 |
|
| 10 |
It is created by the [`BitSlice::rchunks_exact_mut`] method. |
| 11 |
|
| 12 |
## Original |
| 13 |
|
| 14 |
[`slice::RChunksExactMut`](core::slice::RChunksExactMut) |
| 15 |
|
| 16 |
## API Differences |
| 17 |
|
| 18 |
This iterator marks all yielded bit-slices as `::Alias`ed. |
| 19 |
|
| 20 |
## Examples |
| 21 |
|
| 22 |
```rust |
| 23 |
use bitvec::prelude::*; |
| 24 |
|
| 25 |
let bits = bits![mut 0, 1, 0, 0, 0, 1, 1, 1]; |
| 26 |
let mut chunks = unsafe { |
| 27 |
bits.rchunks_exact_mut(3).remove_alias() |
| 28 |
}; |
| 29 |
|
| 30 |
chunks.next().unwrap().fill(false); |
| 31 |
chunks.next().unwrap().fill(true); |
| 32 |
assert!(chunks.next().is_none()); |
| 33 |
chunks.take_remainder().copy_from_bitslice(bits![1, 0]); |
| 34 |
assert!(chunks.take_remainder().is_empty()); |
| 35 |
|
| 36 |
assert_eq!(bits, bits![1, 0, 1, 1, 1, 0, 0, 0]); |
| 37 |
``` |
| 38 |
|
| 39 |
[`BitSlice::rchunks_exact_mut`]: crate::slice::BitSlice::rchunks_exact_mut |
| 40 |
[`.into_remainder()`]: Self::into_remainder |
| 41 |
[`.take_remainder()`]: Self::take_remainder |