Debian Codegraph @

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

raw
1 # Bit Seeking
2
3 This iterator yields indices of bits cleared to `0`, rather than bit-values
4 themselves. It is essentially the inverse of indexing: rather than applying a
5 `usize` to the bit-slice to get a `bool`, this applies a `bool` to get a
6 `usize`.
7
8 It is created by the [`.iter_zeros()`] method on bit-slices.
9
10 ## Examples
11
12 ```rust
13 use bitvec::prelude::*;
14
15 let bits = bits![1, 0, 1, 1, 0];
16 let mut zeros = bits.iter_zeros();
17
18 assert_eq!(zeros.next(), Some(1));
19 assert_eq!(zeros.next(), Some(4));
20 assert!(zeros.next().is_none());
21 ```
22
23 [`.iter_zeros()`]: crate::slice::BitSlice::iter_zeros