pub enum CodecDecodeError<E> {
Decode {
source: E,
input_index: usize,
},
Incomplete {
input_index: usize,
required_total: usize,
available: usize,
},
TrailingInput {
consumed: usize,
remaining: usize,
},
InvalidInputIndex {
index: usize,
len: usize,
},
InvalidOutputIndex {
index: usize,
len: usize,
},
}Expand description
Error reported by codec-backed value and buffered decoder adapters.
The wrapped codec remains responsible for domain-specific decode failures.
This type adds adapter-level failures that cannot be represented by the
wrapped codec itself, such as a value decoder receiving too few units before
it can safely call crate::Codec::decode_unchecked or a buffered decoder
receiving an invalid output start index.
Variants§
Decode
The wrapped codec reported a decode error.
Fields
source: EError returned by the wrapped codec.
Incomplete
The adapter could not safely call the wrapped codec because input ended.
Fields
TrailingInput
A whole-value decode succeeded but left trailing input units.
Fields
InvalidInputIndex
The caller supplied an input index outside the input slice.
Fields
InvalidOutputIndex
The caller supplied an output index outside the output slice.
Implementations§
Source§impl<E> CodecDecodeError<E>
impl<E> CodecDecodeError<E>
Sourcepub const fn incomplete(
input_index: usize,
required_total: usize,
available: usize,
) -> Self
pub const fn incomplete( input_index: usize, required_total: usize, available: usize, ) -> Self
Sourcepub const fn trailing_input(consumed: usize, remaining: usize) -> Self
pub const fn trailing_input(consumed: usize, remaining: usize) -> Self
Sourcepub const fn invalid_input_index(index: usize, len: usize) -> Self
pub const fn invalid_input_index(index: usize, len: usize) -> Self
Trait Implementations§
Source§impl<E: Clone> Clone for CodecDecodeError<E>
impl<E: Clone> Clone for CodecDecodeError<E>
Source§fn clone(&self) -> CodecDecodeError<E>
fn clone(&self) -> CodecDecodeError<E>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<E: Copy> Copy for CodecDecodeError<E>
Source§impl<E: Debug> Debug for CodecDecodeError<E>
impl<E: Debug> Debug for CodecDecodeError<E>
Source§impl<E> Display for CodecDecodeError<E>where
E: Display,
impl<E> Display for CodecDecodeError<E>where
E: Display,
impl<E: Eq> Eq for CodecDecodeError<E>
Source§impl<E> Error for CodecDecodeError<E>
impl<E> Error for CodecDecodeError<E>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl<E: Hash> Hash for CodecDecodeError<E>
impl<E: Hash> Hash for CodecDecodeError<E>
Source§impl<E: PartialEq> PartialEq for CodecDecodeError<E>
impl<E: PartialEq> PartialEq for CodecDecodeError<E>
Source§fn eq(&self, other: &CodecDecodeError<E>) -> bool
fn eq(&self, other: &CodecDecodeError<E>) -> bool
self and other values to be equal, and is used by ==.