Files
2026-08-01 16:11:49 +03:00

983 B

Shared Bit-Slice Iteration

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

Original

slice::Iter

API Differences

While this iterator can manifest &bool references, it instead yields the bitvec proxy reference for consistency with the IterMut type. It can be converted to yield true references with .by_refs(). Additionally, because it does not yield &bool, the Iterator::copied method does not apply. It can be converted to an iterator of bool values with .by_vals().

Examples

use bitvec::prelude::*;

let bits = bits![0, 1];
for bit in bits.iter() {
  # #[cfg(feature = "std")] {
  println!("{}", bit);
  # }
}