[−][src]Trait bitsreader::AsBits
This trait takes a generator of integers and transforms it into a stream of
the bits that compose each of them. This crate already implements it for all
integer types, so it only needs to be brought into scope via
use bitsreader::AsBits
.
If it were to be implemented by some custom numeric type, the trait One must be implemented for it.
Associated Types
Loading content...Required methods
ⓘImportant traits for Bits<I>fn as_bits(self) -> Bits<Self::Iter>
ⓘImportant traits for Bits<I>
Transforms an iterator of integers into a stream of the bits that compose each of them.
Examples
use bitsreader::AsBits; let mut bits = [0b1011_0101u8, 0b0100_1110].iter().as_bits(); assert_eq!(bits.next(), Some(1)); assert_eq!(bits.next(), Some(0)); assert_eq!(bits.nth(6), Some(0)); // The next byte assert_eq!(bits.nth(6), Some(0)); // The last bit assert_eq!(bits.next(), None); assert_eq!(bits.next_back(), Some(0)); // It's also double-ended!
Implementors
impl<'a, I, T, S, B> AsBits for I where
I: Iterator<Item = &'a T> + DoubleEndedIterator + Clone,
T: 'a + Copy + Default + Shr<usize, Output = S>,
S: BitAnd<S, Output = B> + One,
B: PartialEq + One,
[src]
I: Iterator<Item = &'a T> + DoubleEndedIterator + Clone,
T: 'a + Copy + Default + Shr<usize, Output = S>,
S: BitAnd<S, Output = B> + One,
B: PartialEq + One,