pub trait BinIter {
type Iter: Iterator<Item = bool>;
// Required method
fn bin_iter(&self) -> Self::Iter;
}
Expand description
2 進法のイテレータ。
assert!(0_u32.bin_iter().eq([]));
assert!(1_u32.bin_iter().map(u32::from).eq([1]));
assert!(0b_1001011_u64.bin_iter().map(u32::from).eq([1, 1, 0, 1, 0, 0, 1]));
assert!((!0_u128).bin_iter().map(u32::from).eq([1; 128]));