#[non_exhaustive]pub enum ParseError {
OutOfBounds {
value: String,
bound: String,
},
UnknownFormat(String),
UnknownFileType(String),
WrongFormat {
expected: &'static str,
got: String,
},
AssertFail(String),
UnsupportedVersion {
format: &'static str,
version: u32,
supported: &'static [u32],
},
WrongBodyLength {
format: String,
got: u64,
expected: u64,
},
}Expand description
A file that violates its format: unknown tags or lengths, checksum mismatches, out-of-range values, unsupported schema versions.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
OutOfBounds
UnknownFormat(String)
UnknownFileType(String)
WrongFormat
A CBIN tag other than the one the reader was asked for. Formats sharing a body layout decode each other’s files without complaint, so the tag is the only thing that tells them apart.
AssertFail(String)
UnsupportedVersion
A file whose schema version this build has never been validated against.
Field offsets are only known to be right for the versions in the corpus. Decoding a newer one would produce plausible-looking but wrong values, and writing it back would then persist them — so refuse instead.
WrongBodyLength
A body whose length is not the one the format declares — a truncated or padded file on read, a miscounting writer on write.
Trait Implementations§
Source§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
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<!> for ParseError
Lets an infallible decode sit alongside fallible ones behind the same ?.
impl From<!> for ParseError
Lets an infallible decode sit alongside fallible ones behind the same ?.