pub struct DecodeContext {
pub input_start: usize,
pub input_index: usize,
pub output_start: usize,
pub output_index: usize,
pub available: usize,
}Expand description
Context for one codec decode attempt inside a buffered decoder engine.
Fields§
§input_start: usizeAbsolute source index where this transcode call starts.
input_index: usizeAbsolute source index where the attempted value starts.
output_start: usizeAbsolute output index where this transcode call starts.
output_index: usizeAbsolute output index where the next decoded value would be written.
available: usizeUnits visible to the codec from input_index.
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.
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
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DecodeContext
Auto Trait Implementations§
impl Freeze for DecodeContext
impl RefUnwindSafe for DecodeContext
impl Send for DecodeContext
impl Sync for DecodeContext
impl Unpin for DecodeContext
impl UnsafeUnpin for DecodeContext
impl UnwindSafe for DecodeContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more