spacegate_kernel/utils/path.rs
1#[derive(Debug)]
2pub struct PathIter<'a> {
3 inner: std::str::Split<'a, char>,
4}
5
6impl<'a> PathIter<'a> {
7 pub fn new(path: &'a str) -> Self {
8 Self {
9 inner: path.trim_start_matches('/').split('/'),
10 }
11 }
12}
13
14impl<'a> Iterator for PathIter<'a> {
15 type Item = &'a str;
16
17 fn next(&mut self) -> Option<Self::Item> {
18 self.inner.next()
19 }
20}