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.
The path is also expected to be normalized, and should not contain extra separators, and must not contain ..
or have leading or trailing slashes (or additionally backslashes on Windows).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stack
impl RefUnwindSafe for Stack
impl Send for Stack
impl Sync for Stack
impl Unpin for Stack
impl UnwindSafe for Stack
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)