pub struct BoolDecoder<T> {
    data: Cursor<T>,
    range: usize,
    value: usize,
    count: isize,
}
Expand description

The decoder state.

Fields

data: Cursor<T>range: usizevalue: usizecount: isize

Implementations

Creates a new instance.

Fills more bits from data to value. We shall keep at least 8 bits of the current data in value.

Reads the next bit from the coded stream. The probability of the bit to be one is probability / 256.

Reads a “literal”, that is, a “num_bits”-wide unsigned value whose bits come high- to low-order, with each bit encoded at probability 1/2.

Reads a boolean from the coded stream. Returns false if it has reached the end of data and failed to read the boolean. The probability of out to be true is probability / 256, e.g., when probability is 0x80, the chance is 1/2 (i.e., 0x80 / 256).

Reads a boolean from the coded stream. Returns false if it has reached the end of data and failed to read the boolean. The probability of out to be true is probability / 256, e.g., when probability is 0x80, the chance is 1/2 (i.e., 0x80 / 256).

Reads an unsigned literal from the coded stream.

Reads a literal with sign from the coded stream. This is similar to the read_literal(), it first read a “num_bits”-wide unsigned value, and then read an extra bit as the sign of the literal.

Returns the current coded value.

Returns the number of bytes in the value buffer.

Returns the range of the current coded value.

Returns the current bit position.

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.