Skip to main content

EncodeContext

Trait EncodeContext 

Source
pub trait EncodeContext: CodecContext {
    // Required methods
    fn full_data(&self) -> &Wtf8;
    fn data_len(&self) -> StrSize;
    fn remaining_data(&self) -> &Wtf8;
    fn position(&self) -> StrSize;
    fn restart_from(&mut self, pos: StrSize) -> Result<(), Self::Error>;
    fn error_encoding(
        &self,
        range: Range<StrSize>,
        reason: Option<&str>,
    ) -> Self::Error;

    // Provided method
    fn handle_error<E>(
        &mut self,
        errors: &E,
        range: Range<StrSize>,
        reason: Option<&str>,
    ) -> Result<EncodeReplace<Self>, Self::Error>
       where E: EncodeErrorHandler<Self> { ... }
}

Required Methods§

Source

fn full_data(&self) -> &Wtf8

Source

fn data_len(&self) -> StrSize

Source

fn remaining_data(&self) -> &Wtf8

Source

fn position(&self) -> StrSize

Source

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

Source

fn error_encoding( &self, range: Range<StrSize>, reason: Option<&str>, ) -> Self::Error

Provided Methods§

Source

fn handle_error<E>( &mut self, errors: &E, range: Range<StrSize>, reason: Option<&str>, ) -> Result<EncodeReplace<Self>, Self::Error>
where E: EncodeErrorHandler<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§