pub trait Visit {
// Required methods
fn pop_back_tracked_path_and_set_current(&mut self);
fn pop_front_tracked_path_and_set_current(&mut self);
fn push_back_tracked_path_component(&mut self, component: &BStr);
fn push_path_component(&mut self, component: &BStr);
fn pop_path_component(&mut self);
fn visit_tree(&mut self, entry: &EntryRef<'_>) -> Action;
fn visit_nontree(&mut self, entry: &EntryRef<'_>) -> Action;
}
Expand description
A trait to allow responding to a traversal designed to observe all entries in a tree, recursively while keeping track of paths if desired.
Required Methods§
Sourcefn pop_back_tracked_path_and_set_current(&mut self)
fn pop_back_tracked_path_and_set_current(&mut self)
Sets the full path in the back of the queue so future calls to push and pop components affect it instead.
Note that the first call is made without an accompanying call to Self::push_back_tracked_path_component()
This is used by the depth-first traversal of trees.
Sourcefn pop_front_tracked_path_and_set_current(&mut self)
fn pop_front_tracked_path_and_set_current(&mut self)
Sets the full path in front of the queue so future calls to push and pop components affect it instead.
This is used by the breadth-first traversal of trees.
Sourcefn push_back_tracked_path_component(&mut self, component: &BStr)
fn push_back_tracked_path_component(&mut self, component: &BStr)
Append a component
to the end of a path, which may be empty.
If component
is empty, store the current path.
Sourcefn push_path_component(&mut self, component: &BStr)
fn push_path_component(&mut self, component: &BStr)
Append a component
to the end of a path, which may be empty.
Sourcefn pop_path_component(&mut self)
fn pop_path_component(&mut self)
Removes the last component from the path, which may leave it empty.
Sourcefn visit_tree(&mut self, entry: &EntryRef<'_>) -> Action
fn visit_tree(&mut self, entry: &EntryRef<'_>) -> Action
Observe a tree entry that is a tree and return an instruction whether to continue or not.
Action::Skip
can be used to prevent traversing it, for example if it’s known to the caller already.
The implementation may use the current path to learn where in the tree the change is located.
Sourcefn visit_nontree(&mut self, entry: &EntryRef<'_>) -> Action
fn visit_nontree(&mut self, entry: &EntryRef<'_>) -> Action
Observe a tree entry that is NO tree and return an instruction whether to continue or not.
Action::Skip
has no effect here.
The implementation may use the current path to learn where in the tree the change is located.