1
2
3
4
5
6
7
8
9
use typed_path::{Component, WindowsPath};

fn main() {
    let path = WindowsPath::new(r"C:\path\to\file.txt");

    for component in path.components() {
        println!("{}", String::from_utf8_lossy(component.as_bytes()));
    }
}