Skip to main content

CodecDecodeErrorSignal

Trait CodecDecodeErrorSignal 

Source
pub trait CodecDecodeErrorSignal {
    // Provided methods
    fn required_total(&self) -> Option<usize> { ... }
    fn consumed_units(&self) -> Option<NonZeroUsize> { ... }
}
Expand description

Optional stream-recovery signals exposed by codec decode errors.

Concrete codec errors remain responsible for describing their own domain failure. This trait only standardizes the small amount of control-flow information that streaming adapters need when deciding whether to read more input or consume invalid units before reporting an error.

Provided Methods§

Source

fn required_total(&self) -> Option<usize>

Returns the total input units required from the current value start.

§Returns

Returns Some(required) for incomplete input prefixes, or None when the error does not request more input.

Source

fn consumed_units(&self) -> Option<NonZeroUsize>

Returns invalid input units that may be consumed to make progress.

§Returns

Returns Some(consumed) for malformed or non-canonical input that a streaming adapter may discard before surfacing the error, or None when no consumption hint is available.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl CodecDecodeErrorSignal for Infallible

Implementors§