Struct walkdir::Error
[−]
[src]
pub struct Error { /* fields omitted */ }
An error produced by recursively walking a directory.
This error type is a light wrapper around std::io::Error
. In particular,
it adds the following information:
- The depth at which the error occurred in the file tree, relative to the root.
- The path, if any, associated with the IO error.
- An indication that a loop occurred when following symbolic links. In this case, there is no underlying IO error.
To maintain good ergnomics, this type has a
impl From<Error> for std::io::Error
defined so that you may use an
io::Result
with methods in this crate if you don't care about accessing
the underlying error data in a structured form.
Methods
impl Error
[src]
fn path(&self) -> Option<&Path>
Returns the path associated with this error if one exists.
For example, if an error occurred while opening a directory handle,
the error will include the path passed to std::fs::read_dir
.
fn loop_ancestor(&self) -> Option<&Path>
Returns the path at which a cycle was detected.
If no cycle was detected, None
is returned.
A cycle is detected when a directory entry is equivalent to one of its ancestors.
To get the path to the child directory entry in the cycle, use the
path
method.
fn depth(&self) -> usize
Returns the depth at which this error occurred relative to the root.
The smallest depth is 0
and always corresponds to the path given
to the new
function on WalkDir
. Its direct descendents have depth
1
, and their descendents have depth 2
, and so on.
Trait Implementations
impl Debug for Error
[src]
impl Error for Error
[src]
fn description(&self) -> &str
A short description of the error. Read more
fn cause(&self) -> Option<&Error>
The lower-level cause of this error, if any. Read more