changeset 47099 | 3da19db33cbc |
parent 46444 | 6c778d20c8c2 |
child 47113 | be579775c2d9 |
--- a/rust/hg-core/src/utils/hg_path.rs Tue Apr 06 14:29:05 2021 +0200 +++ b/rust/hg-core/src/utils/hg_path.rs Tue Apr 06 14:35:39 2021 +0200 @@ -226,6 +226,11 @@ inner.extend(other.as_ref().bytes()); HgPathBuf::from_bytes(&inner) } + + pub fn components(&self) -> impl Iterator<Item = &HgPath> { + self.inner.split(|&byte| byte == b'/').map(HgPath::new) + } + pub fn parent(&self) -> &Self { let inner = self.as_bytes(); HgPath::new(match inner.iter().rposition(|b| *b == b'/') {