Files
Notes/notes-service/vendor/bitvec/doc/slice/iter/IterMut.md
T
2026-08-01 16:11:49 +03:00

719 B

Exclusive Bit-Slice Iteration

This view iterates each bit in the bit-slice by exclusive proxy reference. It is created by the BitSlice::iter_mut method.

Original

slice::IterMut

API Differences

Because bitvec cannot manifest &mut bool references, this instead yields the crate proxy reference. Because the proxy is a true type, rather than an &mut reference, its name must be bound with mut in order to write through it.

Examples

use bitvec::prelude::*;

let bits = bits![mut 0, 1];
for mut bit in bits.iter_mut() {
  *bit = !*bit;
}
assert_eq!(bits, bits![1, 0]);