[−][src]Trait compact_path_tree::PathVisitor
A visitor that can determine which paths should be included and how errors are handled, or just view paths as the tree is constructed.
Provided methods
fn filter(&mut self, _entry: &DirEntry) -> Result<bool>
Determine whether the given entry should be included in the tree.
When Ok(true)
is returned, the entry is included. When Ok(false)
is
returned, the entry is omitted, including any children for directories.
When Err(..)
is returned, the item is omitted and
PathVisitor::handle_error
is used to determine whether the operation
should fail or not.
fn visit(&mut self, _entry: &DirEntry) -> Result<()>
A general-purpose function for any logic involving included entries.
This is called after filter
and only for entries for which filter
returned Ok(true)
.
fn handle_error(
&mut self,
error: Error,
directory: &Path,
entry: Option<&DirEntry>
) -> Option<Error>
&mut self,
error: Error,
directory: &Path,
entry: Option<&DirEntry>
) -> Option<Error>
Handle a given IO error, determining whether it should be fatal or not.
Some(..)
indicates that the error is fatal and should stop traversal,
and None
indicates that the error is non-fatal and should be ignored.
When an error is ignored, the
This function will be called for any error that occurs, including errors
from PathVisitor::filter
or PathVisitor::visit
.
The default implementation logs PermissionDenied
errors to stderr but
doesn't stop.