Debian Codegraph @

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

raw
1 # Exclusive Bit-Slice Iteration
2
3 This view iterates each bit in the bit-slice by exclusive proxy reference. It is
4 created by the [`BitSlice::iter_mut`] method.
5
6 ## Original
7
8 [`slice::IterMut`](core::slice::IterMut)
9
10 ## API Differences
11
12 Because `bitvec` cannot manifest `&mut bool` references, this instead yields the
13 crate [proxy reference][0]. Because the proxy is a true type, rather than an
14 `&mut` reference, its name must be bound with `mut` in order to write through
15 it.
16
17 ## Examples
18
19 ```rust
20 use bitvec::prelude::*;
21
22 let bits = bits![mut 0, 1];
23 for mut bit in bits.iter_mut() {
24 *bit = !*bit;
25 }
26 assert_eq!(bits, bits![1, 0]);
27 ```
28
29 [`BitSlice::iter_mut`]: crate::slice::BitSlice::iter_mut
30 [0]: crate::ptr::BitRef