#[non_exhaustive]pub enum Error {
NotAContainer {
found: Vec<u8>,
expected: Vec<u8>,
},
Truncated {
what: &'static str,
needed: u64,
available: u64,
},
UnsupportedFormat {
major: u16,
minor: u16,
supported_major: u16,
},
Reserved {
what: &'static str,
},
SectionOutOfBounds {
id: u32,
offset: u64,
end: u64,
file_len: u64,
},
DuplicateSection {
id: u32,
},
MissingRecord(Tag),
RepeatedRecord(Tag),
UnsupportedRecord {
tag: Tag,
version: u16,
},
DigestMismatch {
what: String,
expected: String,
actual: String,
},
Footer(Error),
TooLarge {
what: &'static str,
needed: u64,
},
}Expand description
Why a container could not be read, or could not be trusted once it was read.
Every variant carries enough to put in a log line without going back to the file. An operator who gets one of these should be able to say what is wrong with the dataset without opening a hex editor, because the alternative is that they open a hex editor.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotAContainer
The file does not start with the container magic.
Fields
Truncated
The file starts correctly but ends somewhere unexpected.
Fields
UnsupportedFormat
The container was written by a newer major version.
Fields
Reserved
A reserved field was not zero.
Reserved fields are the only place a future version can put a change that older readers must not ignore, so an older reader has to refuse rather than carry on.
SectionOutOfBounds
A section points somewhere that is not inside the payload area.
Fields
DuplicateSection
Two sections claim the same identifier.
MissingRecord(Tag)
A required footer record was missing.
RepeatedRecord(Tag)
A footer record appeared more times than it is allowed to.
UnsupportedRecord
A known footer record was written at a version this build does not read.
DigestMismatch
A digest did not match the bytes it covers.
Fields
The bytes inside the footer did not parse.
TooLarge
Something in the container is bigger than this build can address.
On a 64 bit host this cannot happen. It is here so that a 32 bit host gets a sentence instead of a panic.
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
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()