pub struct BitRecorder<N, E: Endianness> { /* private fields */ }
Expand description

For recording writes in order to play them back on another writer

Example

use std::io::Write;
use bitstream_io::{BigEndian, BitWriter, BitWrite, BitRecorder};
let mut recorder: BitRecorder<u32, BigEndian> = BitRecorder::new();
recorder.write(1, 0b1).unwrap();
recorder.write(2, 0b01).unwrap();
recorder.write(5, 0b10111).unwrap();
assert_eq!(recorder.written(), 8);
let mut writer = BitWriter::endian(Vec::new(), BigEndian);
recorder.playback(&mut writer);
assert_eq!(writer.into_writer(), [0b10110111]);

Implementations

Creates new recorder

Creates new recorder sized for the given number of writes

Creates new recorder with the given endiannness

Returns number of bits written

Plays recorded writes to the given writer

Trait Implementations

Writes a single bit to the stream. true indicates 1, false indicates 0 Read more
Writes an unsigned value to the stream using the given number of bits. Read more
Writes a twos-complement signed value to the stream with the given number of bits. Read more
Writes value number of 1 bits to the stream and then writes a 0 bit. This field is variably-sized. Read more
Writes value number of 0 bits to the stream and then writes a 1 bit. This field is variably-sized. Read more
Writes the entirety of a byte buffer to the stream. Read more
Returns true if the stream is aligned at a whole byte.
Pads the stream with 0 bits until it is aligned at a whole byte. Does nothing if the stream is already aligned. Read more
Returns the “default value” for a type. Read more
Writes Huffman code for the given symbol to the stream. 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.