Skip to main content

DecodeContext

Trait DecodeContext 

Source
pub trait DecodeContext: CodecContext {
    // Required methods
    fn full_data(&self) -> &[u8] ;
    fn remaining_data(&self) -> &[u8] ;
    fn position(&self) -> usize;
    fn advance(&mut self, by: usize);
    fn restart_from(&mut self, pos: usize) -> Result<(), Self::Error>;
    fn error_decoding(
        &self,
        byte_range: Range<usize>,
        reason: Option<&str>,
    ) -> Self::Error;

    // Provided method
    fn handle_error<E>(
        &mut self,
        errors: &E,
        byte_range: Range<usize>,
        reason: Option<&str>,
    ) -> Result<Self::StrBuf, Self::Error>
       where E: DecodeErrorHandler<Self> { ... }
}

Required Methods§

Source

fn full_data(&self) -> &[u8]

Source

fn remaining_data(&self) -> &[u8]

Source

fn position(&self) -> usize

Source

fn advance(&mut self, by: usize)

Source

fn restart_from(&mut self, pos: usize) -> Result<(), Self::Error>

Source

fn error_decoding( &self, byte_range: Range<usize>, reason: Option<&str>, ) -> Self::Error

Provided Methods§

Source

fn handle_error<E>( &mut self, errors: &E, byte_range: Range<usize>, reason: Option<&str>, ) -> Result<Self::StrBuf, Self::Error>
where E: DecodeErrorHandler<Self>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§