Skip to main content

TreeError

Enum TreeError 

Source
#[non_exhaustive]
pub enum TreeError {
#[non_exhaustive]
Io { kind: ErrorKind, message: String, },
#[non_exhaustive]
Malformed { family: Family, detail: String, },
#[non_exhaustive]
Unsupported { family: Family, detail: String, },
#[non_exhaustive]
LimitExceeded { family: Family, bound: Bound, detail: String, },
#[non_exhaustive]
NotFound { family: Family, path: Vec<u8>, }, }
Expand description

A failure reading a filesystem through the extraction surface.

The classification is shared: whether the source could not be read at all, whether the filesystem’s own bytes are wrong, whether it uses something this build does not follow, whether a bound stopped the read, and whether a path names nothing are the answers a sink acts on, and they mean the same thing for every family. The family’s own message rides along, and a caller that needs the family’s typed error opens that family’s reader directly rather than going through this surface.

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

#[non_exhaustive]
Io

The underlying source could not be read or sought.

The kind is std::io::Error’s own classification, kept beside the message rather than folded into it because it is what a caller acts on: a truncated image (UnexpectedEof) is a property of what is being read, while a permission failure (PermissionDenied) is a property of the environment, and telling them apart should not require matching on text.

It does not appear in the rendered message, because the message already says it: message is the underlying error rendered by std::io::Error, which opens with the kind’s own description. The field is the machine-readable half of a fact the text already carries.

Every error in this crate records an i/o failure this way. They are separate variants on separate enums because their other variants are, and a caller matching on one should not reach through a wrapper for the two fields it wants.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§kind: ErrorKind

How the underlying std::io::Error classified itself.

§message: String

The error rendered as text, for a message a person reads.

§

#[non_exhaustive]
Malformed

The filesystem’s bytes are not what its format requires: a structure did not parse, a reference pointed outside the image, or something failed its own checksum.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§family: Family

The family whose reader refused.

§detail: String

That reader’s own message.

§

#[non_exhaustive]
Unsupported

The image uses something this build’s reader does not follow, so what it holds cannot be reported faithfully.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§family: Family

The family whose reader refused.

§detail: String

That reader’s own message.

§

#[non_exhaustive]
LimitExceeded

A read would have exceeded a bound: one the caller set through Limits, or the longest path a walk builds.

No verdict that the filesystem is malformed: a sound one can reach the caller’s caps and the longest path. Bound::Entries is also reached by an image whose storage describes fewer names than it claims.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§family: Family

The family whose reader stopped.

§bound: Bound

Which bound applied.

§detail: String

That reader’s own message, naming the bound that applied.

§

#[non_exhaustive]
NotFound

A path names nothing in the filesystem: a component that is not there, one that is not a directory with a name after it, or a chain of symbolic links that does not end.

A statement about the path that was asked for, and none about the filesystem.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§family: Family

The family whose reader looked.

§path: Vec<u8>

The path, as it was given.

Trait Implementations§

Source§

impl Clone for TreeError

Source§

fn clone(&self) -> Self

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 TreeError

Source§

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

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

impl Display for TreeError

Source§

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

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

impl Eq for TreeError

Source§

impl Error for TreeError

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 From<ReadError> for TreeError

How a read failure classifies in the crate’s family-agnostic frame.

The mapping is what the crate’s shared surface can say about an ext failure: a source that could not be read stays exactly what it was, a feature this reader does not follow is unsupported, a bound being reached is a limit, and everything else is the image’s own bytes being wrong.

Source§

fn from(err: ReadError) -> Self

Converts to this type from the input type.
Source§

impl From<ReadError> for TreeError

How a read failure classifies in the crate’s family-agnostic frame.

Source§

fn from(err: ReadError) -> Self

Converts to this type from the input type.
Source§

impl From<ReadError> for TreeError

How a read failure classifies in the crate’s family-agnostic frame.

Source§

fn from(err: ReadError) -> Self

Converts to this type from the input type.
Source§

impl From<ReadError> for TreeError

Source§

fn from(err: ReadError) -> Self

Converts to this type from the input type.
Source§

impl From<ReadError> for TreeError

Source§

fn from(err: ReadError) -> Self

Converts to this type from the input type.
Source§

impl From<TreeError> for ArchiveError

Source§

fn from(source: TreeError) -> Self

Converts to this type from the input type.
Source§

impl From<TreeError> for HostError

Source§

fn from(source: TreeError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for TreeError

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TreeError

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.