#[non_exhaustive]pub enum CodecError {
WrongFormat(String),
Malformed(String),
Truncated {
location: SourceLocation,
context: ErrorContext,
},
ResourceLimit(ResourceLimit),
NotImplemented(String),
Io(Error),
}Expand description
Errors a codec can raise.
Marked #[non_exhaustive]: external exhaustive matches must carry a
wildcard arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
WrongFormat(String)
The bytes are not this codec’s format.
Malformed(String)
The container was structurally malformed.
Truncated
A required read extended past the end of its window after commitment.
Distinct from CodecError::Malformed: a truncation is missing input,
not an inconsistency inside the bytes that are present.
Fields
location: SourceLocationWhere the truncated read began.
context: ErrorContextStatic context for the failure.
ResourceLimit(ResourceLimit)
A resource limit refused the decode: policy or the allocator.
Never reported as CodecError::Malformed: a budget refusal is a
statement about policy, not about the input.
NotImplemented(String)
The codec does not implement a required capability.
Io(Error)
Underlying I/O failure.
Implementations§
Source§impl CodecError
impl CodecError
Sourcepub const fn truncated(
location: SourceLocation,
operation: &'static str,
) -> Self
pub const fn truncated( location: SourceLocation, operation: &'static str, ) -> Self
Builds a truncation error at a qualified source location.
Trait Implementations§
Source§impl Debug for CodecError
impl Debug for CodecError
Source§impl Display for CodecError
impl Display for CodecError
Source§impl Error for CodecError
impl Error for CodecError
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()