Skip to main content

BitRead

Trait BitRead 

Source
pub trait BitRead {
Show 14 methods // Required methods fn fill(&mut self); fn peek_no_fill(&self, n: u32) -> u32; fn skip_no_fill(&mut self, n: u32); fn byte_position(&self) -> usize; fn overrun(&self) -> usize; fn buffered(&self) -> u32; fn refill_force(&mut self); // Provided methods fn past_end(&self) -> usize { ... } fn fill_to(&mut self, n: u32) { ... } fn peek(&mut self, n: u32) -> u32 { ... } fn get(&mut self, n: u32) -> u32 { ... } fn skip(&mut self, n: u32) { ... } fn bit(&mut self) -> u32 { ... } fn exhausted(&self) -> bool { ... }
}
Expand description

Common interface of all bit pumps.

Required Methods§

Source

fn fill(&mut self)

Ensure at least 32 bits are buffered (zero-padded past the end of input).

Source

fn peek_no_fill(&self, n: u32) -> u32

Peek n <= 32 bits. Requires a prior BitRead::fill.

Source

fn skip_no_fill(&mut self, n: u32)

Discard n <= 32 bits. Requires that n bits are buffered.

Source

fn byte_position(&self) -> usize

Number of bytes consumed from the input (bits not yet used are excluded).

Source

fn overrun(&self) -> usize

Bytes requested past the end of the input (0 for a well-formed stream). Includes look-ahead that has not been consumed; see BitRead::past_end.

Source

fn buffered(&self) -> u32

Bits currently buffered (not yet consumed).

Source

fn refill_force(&mut self)

Refill to the pump’s maximum fill level even if 32 or more bits are buffered.

Provided Methods§

Source

fn past_end(&self) -> usize

Bytes consumed beyond the end of the input (padding fed but still buffered is not counted). Decoders use this to detect truncated streams precisely.

Source

fn fill_to(&mut self, n: u32)

Ensure at least n bits (n <= 56) are buffered (zero padding past the end).

Source

fn peek(&mut self, n: u32) -> u32

Source

fn get(&mut self, n: u32) -> u32

Source

fn skip(&mut self, n: u32)

Source

fn bit(&mut self) -> u32

Read a single bit.

Source

fn exhausted(&self) -> bool

True if the stream ran (meaningfully) past the end of its data.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§