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

Creates new counter

Returns number of bits written

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 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

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

Performs the conversion.

Performs the conversion.

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.