pub struct DecodeContext { /* private fields */ }Expand description
Context for one codec decode attempt inside a buffered decoder engine.
Implementations§
Source§impl DecodeContext
impl DecodeContext
Sourcepub const fn new(
input_start: usize,
input_index: usize,
output_start: usize,
output_index: usize,
available: usize,
) -> Self
pub const fn new( input_start: usize, input_index: usize, output_start: usize, output_index: usize, available: usize, ) -> Self
Creates a decode context.
§Parameters
input_start: Absolute source index where thistranscodecall starts.input_index: Absolute source index where the attempted value starts.output_start: Absolute output index where thistranscodecall starts.output_index: Absolute output index where the next value would be written.available: Units visible to the codec frominput_index.
§Returns
Returns a decode context.
§Panics
Panics when input_index < input_start or
output_index < output_start.
Sourcepub const fn input_start(self) -> usize
pub const fn input_start(self) -> usize
Returns the absolute source index where this transcode call starts.
§Returns
Returns the input start index.
Sourcepub const fn input_index(self) -> usize
pub const fn input_index(self) -> usize
Returns the absolute source index where the attempted value starts.
§Returns
Returns the current input index.
Sourcepub const fn output_start(self) -> usize
pub const fn output_start(self) -> usize
Returns the absolute output index where this transcode call starts.
§Returns
Returns the output start index.
Sourcepub const fn output_index(self) -> usize
pub const fn output_index(self) -> usize
Returns the absolute output index where the next decoded value would be written.
§Returns
Returns the current output index.
Sourcepub const fn available(self) -> usize
pub const fn available(self) -> usize
Returns units visible to the codec from Self::input_index.
§Returns
Returns the available input-unit count.
Sourcepub const fn input_used(self) -> usize
pub const fn input_used(self) -> usize
Returns input units consumed since this transcode call started.
§Returns
Returns input_index - input_start.
Sourcepub const fn output_written(self) -> usize
pub const fn output_written(self) -> usize
Returns output values written since this transcode call started.
§Returns
Returns output_index - output_start.
Trait Implementations§
Source§impl Clone for DecodeContext
impl Clone for DecodeContext
Source§fn clone(&self) -> DecodeContext
fn clone(&self) -> DecodeContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DecodeContext
Source§impl Debug for DecodeContext
impl Debug for DecodeContext
impl Eq for DecodeContext
Source§impl Hash for DecodeContext
impl Hash for DecodeContext
Source§impl PartialEq for DecodeContext
impl PartialEq for DecodeContext
Source§fn eq(&self, other: &DecodeContext) -> bool
fn eq(&self, other: &DecodeContext) -> bool
self and other values to be equal, and is used by ==.