1 2 3 4 5 6 7 8 9
use typed_path::{Component, UnixPath}; fn main() { let path = UnixPath::new(r"/path/to/file.txt"); for component in path.components() { println!("{}", String::from_utf8_lossy(component.as_bytes())); } }