Struct bit_manager::BitReader [] [src]

pub struct BitReader<T: Read> { /* fields omitted */ }

A wrapper for any type implementing io::Read that allows the reading of individual bits

Example

use bit_manager::{BitReader, BitRead};

let mut reader = BitReader::new([0b01101110u8, 0b10100000u8].as_ref());

assert_eq!(reader.read_bit()?, false);
assert_eq!(reader.read_bit()?, true);
assert_eq!(reader.read_bit()?, true);
assert_eq!(reader.read_byte()?, 0b01110101);

Methods

impl<T: Read> BitReader<T>
[src]

[src]

Creates a new bit reader with the given reader. Uses Precision::Byte by default.

[src]

Creates a new bit reader with the given reader and precision.

[src]

Returns true if the internal buffer is aligned to a byte.

[src]

Aligns the stream to the next byte.

Trait Implementations

impl<T: Read> BitRead for BitReader<T>
[src]

[src]

Reads a single bit.

[src]

Reads a single byte. Read more

[src]

Reads a value that implements [BitStore] using the read_from function. Read more

[src]

Reads a value using a converter that implements [BitConvert] with the read_value_from function. Read more

[src]

Reads values that implement [BitStore] to a buffer. Returns the number of values read. Read more

[src]

Reads values using a converter that implements [BitConvert] to a buffer. Returns the number of values read. Read more