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§
Sourcefn peek_no_fill(&self, n: u32) -> u32
fn peek_no_fill(&self, n: u32) -> u32
Peek n <= 32 bits. Requires a prior BitRead::fill.
Sourcefn skip_no_fill(&mut self, n: u32)
fn skip_no_fill(&mut self, n: u32)
Discard n <= 32 bits. Requires that n bits are buffered.
Sourcefn byte_position(&self) -> usize
fn byte_position(&self) -> usize
Number of bytes consumed from the input (bits not yet used are excluded).
Sourcefn overrun(&self) -> usize
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.
Sourcefn refill_force(&mut self)
fn refill_force(&mut self)
Refill to the pump’s maximum fill level even if 32 or more bits are buffered.
Provided Methods§
Sourcefn past_end(&self) -> usize
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.
Sourcefn fill_to(&mut self, n: u32)
fn fill_to(&mut self, n: u32)
Ensure at least n bits (n <= 56) are buffered (zero padding past the end).
fn peek(&mut self, n: u32) -> u32
fn get(&mut self, n: u32) -> u32
fn skip(&mut self, n: u32)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".