Enum fs_mistrust::Error

source ·
#[non_exhaustive]
pub enum Error {
Show 16 variants NotFound(PathBuf), BadPermission(PathBufu32u32), BadOwner(PathBufu32), BadType(PathBuf), CouldNotInspect(PathBufArc<IoError>), Multiple(Vec<Box<Error>>), StepsExceeded, CurrentDirectory(Arc<IoError>), CreatingDir(Arc<IoError>), Content(Box<Error>), Listing(Arc<Error>), InvalidSubdirectory, Io { filename: PathBuf, action: &'static str, err: Arc<IoError>, }, MissingField(UninitializedFieldError), NoSuchGroup(String), NoSuchUser(String),
}
Expand description

An error returned while checking a path for privacy.

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

NotFound(PathBuf)

A target (or one of its ancestors) was not found.

§

BadPermission(PathBufu32u32)

A target (or one of its ancestors) had incorrect permissions.

Only generated on unix-like systems.

The first integer contains the current permission bits, and the second contains the permission bits which were incorrectly set.

§

BadOwner(PathBufu32)

A target (or one of its ancestors) had an untrusted owner.

Only generated on unix-like systems.

The provided integer contains the user_id o

§

BadType(PathBuf)

A target (or one of its ancestors) had the wrong type.

Ordinarily, the target may be anything at all, though you can override this with require_file and require_directory.

§

CouldNotInspect(PathBufArc<IoError>)

We were unable to inspect the target or one of its ancestors.

(Ironically, we might lack permissions to see if something’s permissions are correct.)

(The std::io::Error that caused this problem is wrapped in an Arc so that our own Error type can implement Clone.)

§

Multiple(Vec<Box<Error>>)

Multiple errors occurred while inspecting the target.

This variant will only be returned if the caller specifically asked for it by calling all_errors.

We will never construct an instance of this variant with an empty Vec.

§

StepsExceeded

We’ve realized that we can’t finish resolving our path without taking more than the maximum number of steps. The likeliest explanation is a symlink loop.

§

CurrentDirectory(Arc<IoError>)

We can’t find our current working directory, or we found it but it looks impossible.

§

CreatingDir(Arc<IoError>)

We tried to create a directory, and encountered a failure in doing so.

§

Content(Box<Error>)

We found a problem while checking the contents of the directory.

§

Listing(Arc<Error>)

Available on crate feature walkdir only.

We were unable to inspect the contents of the directory

This error is only present when the walkdir feature is enabled.

§

InvalidSubdirectory

Tried to use an invalid path with a CheckedDir,

§

Io

Fields

§filename: PathBuf

The file that we were trying to modify or inspect

§action: &'static str

The action that failed.

§err: Arc<IoError>

The error that we got when trying to perform the operation.

We encountered an error while attempting an IO operation on a file.

§

MissingField(UninitializedFieldError)

A field was missing when we tried to construct a Mistrust.

§

NoSuchGroup(String)

A group that we were configured to trust could not be found.

§

NoSuchUser(String)

A user that we were configured to trust could not be found.

Implementations§

Return the path, if any, associated with this error.

Return true iff this error indicates a problem with filesystem permissions.

(Other errors typically indicate an IO problem, possibly one preventing us from looking at permissions in the first place)

Return an iterator over all of the errors contained in this Error.

If this is a singleton, the iterator returns only a single element. Otherwise, it returns all the elements inside the Error::Multiple variant.

Does not recurse, since we do not create nested instances of Error::Multiple.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0: use the Display impl or to_string()
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
Converts to this type from the input type.
Creates a value from an iterator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.