Skip to main content

SnapshotError

Enum SnapshotError 

Source
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.

Fields

§needed: usize

Bytes required for the fixed header.

§actual: usize

Bytes actually provided.

§

MalformedHeader

Header bytes were present but could not be interpreted.

§

BadMagic

Magic bytes did not match FORMAT_MAGIC.

Fields

§actual: [u8; 8]

Actual magic bytes from the snapshot.

§

FormatMajorMismatch

Format major version did not equal the supported value.

Fields

§actual: u32

Major version recorded in the snapshot.

§supported: u32

Major version this library supports.

§

FormatMinorTooNew

Format minor version was newer than this library can read.

Fields

§actual: u32

Minor version recorded in the snapshot.

§max_supported: u32

Highest minor version this library accepts.

§

HeaderSizeMismatch

Header header_size field did not match the expected value.

Fields

§actual: u32

header_size value recorded in the snapshot.

§expected: u32

Header size this library expects.

§

NonZeroHeaderReserved

Header reserved bytes were not all zero.

§

SectionCountTooLarge

section_count exceeded the v1 cap.

Fields

§count: u32

Section count recorded in the snapshot.

§max: u32

Maximum permitted section count.

§

TruncatedSectionTable

Bytes after the header were too short for the declared section table.

Fields

§needed: usize

Bytes required for the declared section table.

§actual: usize

Bytes available after the header.

§

MalformedSectionTable

Section table bytes could not be interpreted.

§

NonZeroEntryChecksum

A section entry’s reserved_checksum bytes were not all zero.

Fields

§kind: u32

Section kind whose entry violated the invariant.

§

NonZeroEntryReserved

A section entry’s trailing reserved bytes were not all zero.

Fields

§kind: u32

Section kind whose entry violated the invariant.

§

UnsupportedFlags

A section entry declared an unsupported flags bit.

Fields

§kind: u32

Section kind whose entry violated the invariant.

§flags: u8

Flags byte recorded in the entry.

§

AlignmentLog2TooLarge

A section entry declared an alignment_log2 larger than permitted.

Fields

§kind: u32

Section kind whose entry violated the invariant.

§alignment_log2: u8

Declared alignment_log2 value.

§

SectionRangeOverflow

offset + length overflowed u64 for one entry.

Fields

§kind: u32

Section kind whose entry violated the invariant.

§

SectionOutOfBounds

A section’s byte range fell outside the snapshot.

Fields

§kind: u32

Section kind whose entry violated the invariant.

§offset: u64

Declared byte offset.

§length: u64

Declared byte length.

§snapshot_len: u64

Total snapshot byte length.

§

UnsortedSectionTable

Section table entries were not in monotonic non-decreasing offset order or one entry overlapped its predecessor.

Fields

§index: usize

Index of the entry whose offset violated monotonicity.

§

DuplicateKind

Two section entries shared the same kind.

Fields

§kind: u32

Duplicated section kind.

§

UsizeOverflow

A u64 value could not be represented as usize on this target.

Fields

§value: u64

Value that could not be represented as usize.

Trait Implementations§

Source§

impl Clone for SnapshotError

Source§

fn clone(&self) -> SnapshotError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SnapshotError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SnapshotError

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SnapshotError

Source§

impl Error for SnapshotError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for SnapshotError

Source§

fn eq(&self, other: &SnapshotError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for SnapshotError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.