pub struct BitReader { /* private fields */ }
Expand description

A BitReader holds a buffer used to store the individual bits read in from a file.

Implementations

Returns a new instance of the BitReader struct with an empty buffer.

Examples
use bit_buffers::BitReader;
let _bit_reader = BitReader::new();

Loads the bits stored in a file into this BitReader.

Arguments
  • file_name (&str) - A string slice that holds the name of the file
Errors

This function will return an error if file_name does not already exist. Other errors may be returned according to OpenOptions::open.

It will also return an error if it encounters while reading an error of a kind other than io::ErrorKind::Interrupted.

Examples
use bit_buffers::BitReader;
let mut bit_reader = BitReader::new();
bit_reader.load_from_file("my_bit_file.bit");

Reads the current bit being referenced by this BitReader.

Examples
use bit_buffers::BitReader;
let mut bit_reader = BitReader::new();
bit_reader.load_from_file("my_bit_file.bit");
let bit_option = bit_reader.read_bit();
if let Some(bit) = bit_option {
    println!("Read in a {} bit from bit_reader", bit);
}

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.