pub struct Stack { /* private fields */ }
Expand description
A stack of path components with the delegation of side-effects as the currently set path changes, component by component.
Implementations§
source§impl Stack
impl Stack
sourcepub fn new(root: PathBuf) -> Self
pub fn new(root: PathBuf) -> Self
Create a new instance with root
being the base for all future paths we handle, assuming it to be valid which includes
symbolic links to be included in it as well.
sourcepub fn make_relative_path_current(
&mut self,
relative: &Path,
delegate: &mut dyn Delegate
) -> Result<()>
pub fn make_relative_path_current( &mut self, relative: &Path, delegate: &mut dyn Delegate ) -> Result<()>
Set the current stack to point to the relative
path and call push_comp()
each time a new path component is popped
along with the stacks state for inspection to perform an operation that produces some data.
The full path to relative
will be returned along with the data returned by push_comp
.
Note that this only works correctly for the delegate’s push_directory()
and pop_directory()
methods if
relative
paths are terminal, so point to their designated file or directory.