gix_fs

Struct Stack

source
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

Access

source

pub fn root(&self) -> &Path

Returns the top-level path of the stack.

source

pub fn current(&self) -> &Path

Returns the absolute path the currently set path.

source

pub fn current_relative(&self) -> &Path

Returns the currently set path relative to the root().

source§

impl Stack

source

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.

source

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§

source§

impl Clone for Stack

source§

fn clone(&self) -> Stack

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.