Struct bitstream_io::write::BitCounter [−][src]
pub struct BitCounter<N, E: Endianness> { /* fields omitted */ }
Expand description
For counting the number of bits written but generating no output.
Example
use bitstream_io::{BigEndian, BitWrite, BitCounter}; let mut writer: BitCounter<u32, BigEndian> = BitCounter::new(); writer.write(1, 0b1).unwrap(); writer.write(2, 0b01).unwrap(); writer.write(5, 0b10111).unwrap(); assert_eq!(writer.written(), 8);
Implementations
Trait Implementations
impl<N, E> BitWrite for BitCounter<N, E> where
E: Endianness,
N: Copy + AddAssign + From<u32> + Rem<Output = N> + PartialEq,
[src]
impl<N, E> BitWrite for BitCounter<N, E> where
E: Endianness,
N: Copy + AddAssign + From<u32> + Rem<Output = N> + PartialEq,
[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 0 bits to the stream
and then writes a 1 bit. This field is variably-sized. 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 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 BitCounter<N, E> where
E: Endianness,
N: AddAssign + From<u32>,
[src]
impl<N, E> HuffmanWrite<E> for BitCounter<N, E> where
E: Endianness,
N: AddAssign + From<u32>,
[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 BitCounter<N, E> where
E: RefUnwindSafe,
N: RefUnwindSafe,
impl<N, E> Send for BitCounter<N, E> where
E: Send,
N: Send,
impl<N, E> Sync for BitCounter<N, E> where
E: Sync,
N: Sync,
impl<N, E> Unpin for BitCounter<N, E> where
E: Unpin,
N: Unpin,
impl<N, E> UnwindSafe for BitCounter<N, E> where
E: UnwindSafe,
N: UnwindSafe,