Enum fs_mistrust::Error
source · [−]#[non_exhaustive]
pub enum Error {
Show 17 variants
NotFound(PathBuf),
BadPermission(PathBuf, u32, u32),
BadOwner(PathBuf, u32),
BadType(PathBuf),
CouldNotInspect(PathBuf, Arc<IoError>),
Multiple(Vec<Box<Error>>),
StepsExceeded,
CurrentDirectory(Arc<IoError>),
CreatingDir(Arc<IoError>),
Content(Box<Error>),
Listing(Arc<Error>),
InvalidSubdirectory,
Io(PathBuf, Arc<IoError>),
NoTempFile(PathBuf),
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
NotFound(PathBuf)
A target (or one of its ancestors) was not found.
BadPermission(PathBuf, u32, u32)
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(PathBuf, u32)
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(PathBuf, Arc<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>)
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(PathBuf, Arc<IoError>)
We encountered an error while attempting an IO operation on a file.
NoTempFile(PathBuf)
We could not create an unused temporary path when trying to write 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
sourceimpl Error
impl Error
sourcepub fn is_bad_permission(&self) -> bool
pub fn is_bad_permission(&self) -> bool
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)
sourcepub fn errors<'a>(&'a self) -> impl Iterator<Item = &Error> + 'a
pub fn errors<'a>(&'a self) -> impl Iterator<Item = &Error> + 'a
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
sourceimpl Error for Error
impl Error for Error
sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl From<UninitializedFieldError> for Error
impl From<UninitializedFieldError> for Error
sourcefn from(source: UninitializedFieldError) -> Self
fn from(source: UninitializedFieldError) -> Self
Converts to this type from the input type.
sourceimpl FromIterator<Error> for Option<Error>
impl FromIterator<Error> for Option<Error>
sourcefn from_iter<T: IntoIterator<Item = Error>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Error>>(iter: T) -> Self
Creates a value from an iterator. Read more
Auto Trait Implementations
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more