pub enum SnapshotError {
Show 19 variants
TruncatedHeader {
needed: usize,
actual: usize,
},
MalformedHeader,
BadMagic {
actual: [u8; 8],
},
FormatMajorMismatch {
actual: u32,
supported: u32,
},
FormatMinorTooNew {
actual: u32,
max_supported: u32,
},
HeaderSizeMismatch {
actual: u32,
expected: u32,
},
NonZeroHeaderReserved,
SectionCountTooLarge {
count: u32,
max: u32,
},
TruncatedSectionTable {
needed: usize,
actual: usize,
},
MalformedSectionTable,
NonZeroEntryChecksum {
kind: u32,
},
NonZeroEntryReserved {
kind: u32,
},
UnsupportedFlags {
kind: u32,
flags: u8,
},
AlignmentLog2TooLarge {
kind: u32,
alignment_log2: u8,
},
SectionRangeOverflow {
kind: u32,
},
SectionOutOfBounds {
kind: u32,
offset: u64,
length: u64,
snapshot_len: u64,
},
UnsortedSectionTable {
index: usize,
},
DuplicateKind {
kind: u32,
},
UsizeOverflow {
value: u64,
},
}Expand description
Snapshot container validation error.
Returned by Snapshot::open and
Snapshot::open_with for any header,
section table, or layout-level invariant violation.
§Performance
perf: unspecified; errors are returned only from validation paths.
Variants§
TruncatedHeader
Snapshot bytes were shorter than the fixed header.
MalformedHeader
Header bytes were present but could not be interpreted.
BadMagic
Magic bytes did not match FORMAT_MAGIC.
FormatMajorMismatch
Format major version did not equal the supported value.
Fields
FormatMinorTooNew
Format minor version was newer than this library can read.
Fields
HeaderSizeMismatch
Header header_size field did not match the expected value.
Fields
NonZeroHeaderReserved
Header reserved bytes were not all zero.
SectionCountTooLarge
section_count exceeded the v1 cap.
TruncatedSectionTable
Bytes after the header were too short for the declared section table.
Fields
MalformedSectionTable
Section table bytes could not be interpreted.
NonZeroEntryChecksum
A section entry’s reserved_checksum bytes were not all zero.
NonZeroEntryReserved
A section entry’s trailing reserved bytes were not all zero.
UnsupportedFlags
A section entry declared an unsupported flags bit.
Fields
AlignmentLog2TooLarge
A section entry declared an alignment_log2 larger than permitted.
Fields
SectionRangeOverflow
offset + length overflowed u64 for one entry.
SectionOutOfBounds
A section’s byte range fell outside the snapshot.
Fields
UnsortedSectionTable
Section table entries were not in monotonic non-decreasing offset order or one entry overlapped its predecessor.
DuplicateKind
Two section entries shared the same kind.
UsizeOverflow
A u64 value could not be represented as usize on this target.
Trait Implementations§
Source§impl Clone for SnapshotError
impl Clone for SnapshotError
Source§fn clone(&self) -> SnapshotError
fn clone(&self) -> SnapshotError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SnapshotError
impl Debug for SnapshotError
Source§impl Display for SnapshotError
impl Display for SnapshotError
Source§impl Error for SnapshotError
impl Error for SnapshotError
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 PartialEq for SnapshotError
impl PartialEq for SnapshotError
Source§fn eq(&self, other: &SnapshotError) -> bool
fn eq(&self, other: &SnapshotError) -> bool
self and other values to be equal, and is used by ==.