Struct bitstream_io::write::BitRecorder [−][src]
pub struct BitRecorder<N, E: Endianness> { /* fields omitted */ }
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 sized for the given number of writes
Trait Implementations
impl<N, E> BitWrite for BitRecorder<N, E> where
E: Endianness,
N: Copy + From<u32> + AddAssign + Rem<Output = N> + Eq,
[src]
impl<N, E> BitWrite for BitRecorder<N, E> where
E: Endianness,
N: Copy + From<u32> + AddAssign + Rem<Output = N> + Eq,
[src]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
impl<N, E> HuffmanWrite<E> for BitRecorder<N, E> where
E: Endianness,
N: Copy + From<u32> + AddAssign + Rem<Output = N> + Eq,
[src]
impl<N, E> HuffmanWrite<E> for BitRecorder<N, E> where
E: Endianness,
N: Copy + From<u32> + AddAssign + Rem<Output = N> + Eq,
[src]fn write_huffman<T>(
&mut self,
tree: &WriteHuffmanTree<E, T>,
symbol: T
) -> Result<()> where
T: Ord + Copy,
[src]
fn write_huffman<T>(
&mut self,
tree: &WriteHuffmanTree<E, T>,
symbol: T
) -> Result<()> where
T: Ord + Copy,
[src]Writes Huffman code for the given symbol to the stream. Read more
Auto Trait Implementations
impl<N, E> RefUnwindSafe for BitRecorder<N, E> where
E: RefUnwindSafe,
N: RefUnwindSafe,
impl<N, E> Send for BitRecorder<N, E> where
E: Send,
N: Send,
impl<N, E> Sync for BitRecorder<N, E> where
E: Sync,
N: Sync,
impl<N, E> Unpin for BitRecorder<N, E> where
E: Unpin,
N: Unpin,
impl<N, E> UnwindSafe for BitRecorder<N, E> where
E: UnwindSafe,
N: UnwindSafe,