@@ -477,42 +477,42 @@ impl<T: ScalarBitSetStorage> CompoundBitSet<T> {
477477 /// # Example
478478 ///
479479 /// ```
480- /// use cranelift_bitset::CompoundBitSet;
480+ /// use cranelift_bitset::{ CompoundBitSet, ScalarBitSet} ;
481481 ///
482482 /// let mut bitset = CompoundBitSet::<u32>::default();
483483 ///
484484 /// assert_eq!(
485- /// bitset.iter_words ().collect::<Vec<_>>(),
485+ /// bitset.iter_scalars ().collect::<Vec<_>>(),
486486 /// [],
487487 /// );
488488 ///
489489 /// bitset.insert(0);
490490 ///
491491 /// assert_eq!(
492- /// bitset.iter_words ().collect::<Vec<_>>(),
493- /// [0x1],
492+ /// bitset.iter_scalars ().collect::<Vec<_>>(),
493+ /// [ScalarBitSet( 0x1) ],
494494 /// );
495495 ///
496496 /// bitset.insert(1);
497497 ///
498498 /// assert_eq!(
499- /// bitset.iter_words ().collect::<Vec<_>>(),
500- /// [0x3],
499+ /// bitset.iter_scalars ().collect::<Vec<_>>(),
500+ /// [ScalarBitSet( 0x3) ],
501501 /// );
502502 ///
503503 /// bitset.insert(32);
504504 ///
505505 /// assert_eq!(
506- /// bitset.iter_words ().collect::<Vec<_>>(),
507- /// [0x3, 0x1],
506+ /// bitset.iter_scalars ().collect::<Vec<_>>(),
507+ /// [ScalarBitSet( 0x3), ScalarBitSet( 0x1) ],
508508 /// );
509509 /// ```
510- pub fn iter_words ( & self ) -> impl Iterator < Item = T > + ' _ {
510+ pub fn iter_scalars ( & self ) -> impl Iterator < Item = ScalarBitSet < T > > + ' _ {
511511 let nwords = match self . max {
512512 Some ( n) => 1 + ( n as usize / Self :: BITS_PER_SCALAR ) ,
513513 None => 0 ,
514514 } ;
515- self . elems . iter ( ) . map ( |b| b . 0 ) . take ( nwords)
515+ self . elems . iter ( ) . copied ( ) . take ( nwords)
516516 }
517517}
518518
0 commit comments