pub trait BitReader {
    fn peek(&self, bits: u8) -> Option<u16>;
fn consume(&mut self, bits: u8); fn expect(&mut self, bits: Bits) -> Result<(), Option<Bits>> { ... } }
Expand description

Trait used to read data bitwise.

For lazy people ByteReader is provided which implements this trait.

Required methods

look at the next (up to 16) bits of data

Data is returned in the lower bits of the u16.

Consume the given amount of bits from the input.

Provided methods

Assert that the next bits matches the given pattern.

If it does not match, the found pattern is returned if enough bits are aviable. Otherwise None is returned.

Implementors