Returns an iterator over the words of this bit-set or the in-memory representation of the bit set. # Example ``` use cranelift_bitset::{CompoundBitSet, ScalarBitSet}; let mut bitset = CompoundBitSet:: ::default(); assert_eq!( bitset.iter_scalars().collect:: >(), [], ); bitset.insert(0); assert_eq!( bitset.iter_scalars().collect:: >(), [ScalarBitSet(0x1)], ); bitset.insert(1)
(&self)
| 545 | /// ); |
| 546 | /// ``` |
| 547 | pub fn iter_scalars(&self) -> impl Iterator<Item = ScalarBitSet<T>> + '_ { |
| 548 | let nwords = match self.max { |
| 549 | Some(n) => 1 + (n as usize / Self::BITS_PER_SCALAR), |
| 550 | None => 0, |
| 551 | }; |
| 552 | self.elems.iter().copied().take(nwords) |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | impl<'a, T: ScalarBitSetStorage> IntoIterator for &'a CompoundBitSet<T> { |