A file path in #Rust can be a simple UTF-8 string (String/&str), or a string in an OS-dependent encoding (OsString/OsStr), or a wrapper type specifically for manipulating paths (PathBuf/&Path).
With the help of `AsRef` trait you can write functions that seamlessly work with all of these types:
fn takes_path<P: AsRef<Path>>(path: P) {
let path = path.as_ref();
// Now the path is always just &Path
}
Try it: https://is.gd/01ZiqK