Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error { NotAPack, UnsupportedFormat { found: u32, }, UnsupportedSchema { found: u32, }, DigestMismatch { stated: String, computed: String, }, NotText, Malformed(String), Io(String), }
Expand description

Why a byte sequence is not a pack this reader will serve.

Every variant is a refusal before the first record: a reader that served half a catalogue and then noticed would have already handed out records nothing verified.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

NotAPack

The first line does not open with the pack’s magic word — this is not a pack at all.

§

UnsupportedFormat

The pack declares a container format this reader does not implement, named so an operator reads “upgrade the reader” rather than “the file is corrupt”.

Fields

§found: u32

The version the file declares.

§

UnsupportedSchema

The pack’s documents carry a schema version this reader does not serve — fail closed, by name, exactly as the story’s forward-compatibility note requires.

Fields

§found: u32

The schema version the header declares.

§

DigestMismatch

The stated digest is not the digest of the content. Truncation, corruption or a hand-edit; whichever it was, no record is served from bytes that disagree with their own header.

Fields

§stated: String

The digest the header states.

§computed: String

The digest the bytes actually have.

§

NotText

The bytes are not valid UTF-8, which a pack — a text container over JSON — always is.

§

Malformed(String)

Structurally not a version-1 pack: a missing header line, a malformed row, a span pointing outside the payload, a payload shorter than declared. The string names the offender.

§

Io(String)

Pack::load could not read the file. The message carries the path.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

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

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.