Add each_parent to WindowsPath
This commit is contained in:
parent
8f5cb92f89
commit
d600601162
1 changed files with 8 additions and 0 deletions
|
@ -508,6 +508,14 @@ impl WindowsPath {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Execute a function on p as well as all of its ancestors
|
||||
pub fn each_parent(&self, f: &fn(&Path)) {
|
||||
if !self.components.is_empty() {
|
||||
f(self);
|
||||
self.pop().each_parent(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToStr for PosixPath {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue