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