In writing platform-agnostic Rust code, are slashes for directory separators OK:
let path = PathBuf::from("dir1/dir2/file")
or is it better to use:
let path: PathBuf = ["dir1", "dir2", "file"].iter().collect();
I don't have a Windows system to test on, but if we have to support Windows in future I don't want to have to go back and fix all the slashes. I don't know what will happen with PathBuf::from("dir1/dir2/file") on Windows: will something convert to backslashes?
Both styles seem present in the docs: https://doc.rust-lang.org/std/path/index.html#simple-usage