spacegate_kernel/utils/
path.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#[derive(Debug)]
pub struct PathIter<'a> {
    inner: std::str::Split<'a, char>,
}

impl<'a> PathIter<'a> {
    pub fn new(path: &'a str) -> Self {
        Self {
            inner: path.trim_start_matches('/').split('/'),
        }
    }
}

impl<'a> Iterator for PathIter<'a> {
    type Item = &'a str;

    fn next(&mut self) -> Option<Self::Item> {
        self.inner.next()
    }
}