#[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]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
kind: ErrorKindHow the underlying std::io::Error classified itself.
#[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]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]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]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
Trait Implementations§
impl Eq for TreeError
Source§impl Error for TreeError
impl Error for TreeError
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 From<ReadError> for TreeError
How a read failure classifies in the crate’s family-agnostic frame.
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§impl From<ReadError> for TreeError
How a read failure classifies in the crate’s family-agnostic frame.
impl From<ReadError> for TreeError
How a read failure classifies in the crate’s family-agnostic frame.
Source§impl From<ReadError> for TreeError
How a read failure classifies in the crate’s family-agnostic frame.
impl From<ReadError> for TreeError
How a read failure classifies in the crate’s family-agnostic frame.