#[non_exhaustive]pub struct Error {
pub kind: ErrorKind,
pub at: Position,
}Expand description
An error from a decoder or encoder, with the stream position it was found at.
Errors are Copy: after one, the codec repeats it on every later call
until it is reset, so a caller that retries sees exactly the same error.
Build one with Error::new.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: ErrorKindWhat went wrong.
at: PositionWhere it was found.
Implementations§
Source§impl Error
impl Error
Sourcepub const fn is_data_error(&self) -> bool
pub const fn is_data_error(&self) -> bool
Whether the bytes of the stream are at fault (ErrorKind::Corrupt
or ErrorKind::Truncated), as opposed to the parameters or the
memory available. A container that can repair or refetch data treats
these as repairable.
Sourcepub const fn is_resource_error(&self) -> bool
pub const fn is_resource_error(&self) -> bool
Whether memory refused the model (ErrorKind::MemoryLimit or
ErrorKind::AllocationFailed), as opposed to the data, the
parameters or the codec. A container reports these as a resource
limit rather than as damage.
Trait Implementations§
impl Copy for Error
Source§impl Display for Error
The text deliberately avoids the words “method”, “unsupported”,
“password” and “encrypted”: archive tooling downstream classifies errors
by matching them, and a PPMd error is none of those.
impl Display for Error
The text deliberately avoids the words “method”, “unsupported”, “password” and “encrypted”: archive tooling downstream classifies errors by matching them, and a PPMd error is none of those.
impl Eq for Error
Source§impl Error for Error
impl Error for Error
1.30.0 · 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 From<Error> for Error
Available on crate feature std only.Errors as std::io::Errors, for code that drives a codec through
Read or Write: a corrupt stream is InvalidData, a truncated one
UnexpectedEof, bad parameters InvalidInput, a memory refusal
OutOfMemory, and an internal failure Other. The Error stays inside
and can be recovered with downcast::<Error>().
impl From<Error> for Error
std only.Errors as std::io::Errors, for code that drives a codec through
Read or Write: a corrupt stream is InvalidData, a truncated one
UnexpectedEof, bad parameters InvalidInput, a memory refusal
OutOfMemory, and an internal failure Other. The Error stays inside
and can be recovered with downcast::<Error>().