| 1 |
# Shared Bit-Slice Reverse Exact Chunking |
| 2 |
|
| 3 |
This iterator yields successive non-overlapping chunks of a bit-slice. Chunking |
| 4 |
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 [`.remainder()`] method. |
| 9 |
|
| 10 |
It is created by the [`BitSlice::rchunks_exact`] method. |
| 11 |
|
| 12 |
## Original |
| 13 |
|
| 14 |
[`slice::RChunksExact`](core::slice::RChunksExact) |
| 15 |
|
| 16 |
## Examples |
| 17 |
|
| 18 |
```rust |
| 19 |
use bitvec::prelude::*; |
| 20 |
|
| 21 |
let bits = bits![0, 1, 0, 0, 0, 1, 1, 1]; |
| 22 |
let mut chunks = bits.rchunks_exact(3); |
| 23 |
|
| 24 |
assert_eq!(chunks.next().unwrap(), bits![1; 3]); |
| 25 |
assert_eq!(chunks.next().unwrap(), bits![0; 3]); |
| 26 |
assert!(chunks.next().is_none()); |
| 27 |
assert_eq!(chunks.remainder(), bits![0, 1]); |
| 28 |
``` |
| 29 |
|
| 30 |
[`BitSlice::rchunks_exact`]: crate::slice::BitSlice::rchunks_exact |
| 31 |
[`.remainder()`]: Self::remainder |