Trait nekolib_doc::integer::bin_iter::BinIter

source ·
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]));

Required Associated Types§

source

type Iter: Iterator<Item = bool>

Required Methods§

source

fn bin_iter(&self) -> Self::Iter

Implementations on Foreign Types§

source§

impl BinIter for u8

source§

impl BinIter for u16

source§

impl BinIter for u32

source§

impl BinIter for u64

source§

impl BinIter for u128

source§

impl BinIter for usize

Implementors§