Trait gix_fs::stack::Delegate

source ·
pub trait Delegate {
    // Required methods
    fn push_directory(&mut self, stack: &Stack) -> Result<()>;
    fn push(&mut self, is_last_component: bool, stack: &Stack) -> Result<()>;
    fn pop_directory(&mut self);
}
Expand description

A delegate for use in a Stack.

Required Methods§

source

fn push_directory(&mut self, stack: &Stack) -> Result<()>

Called whenever we push a directory on top of the stack, and after the respective call to push().

It is only called if the currently acted on path is a directory in itself, which is determined by knowing that it’s not the last component of the path. Use Stack::current() to see the directory.

source

fn push(&mut self, is_last_component: bool, stack: &Stack) -> Result<()>

Called after any component was pushed, with the path available at Stack::current().

is_last_component is true if the path is completely built, which typically means it’s not a directory.

source

fn pop_directory(&mut self)

Called right after a directory-component was popped off the stack.

Use it to pop information off internal data structures. Note that no equivalent call exists for popping the file-component.

Implementors§