Debian Codegraph @

debian/rust-vendor/bitvec/doc/slice/iter/ChunksMut.md

raw
1 # Exclusive Bit-Slice Chunking
2
3 This iterator yields successive non-overlapping mutable chunks of a bit-slice.
4 Chunking advances one subslice at a time, starting at the beginning of the
5 bit-slice.
6
7 If the original bit-slice’s length is not evenly divided by the chunk width,
8 then the final chunk will be the remainder, and will be shorter than requested.
9
10 It is created by the [`BitSlice::chunks_mut`] method.
11
12 ## Original
13
14 [`slice::ChunksMut`](core::slice::ChunksMut)
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, 0, 0, 1, 1, 1, 0, 1];
26 let mut chunks = unsafe {
27 bits.chunks_mut(3).remove_alias()
28 };
29
30 chunks.next().unwrap().fill(true);
31 chunks.next().unwrap().fill(false);
32 chunks.next().unwrap().copy_from_bitslice(bits![1, 0]);
33 assert!(chunks.next().is_none());
34
35 assert_eq!(bits, bits![1, 1, 1, 0, 0, 0, 1, 0]);
36 ```
37
38 [`BitSlice::chunks_mut`]: crate::slice::BitSlice::chunks_mut