The only really cross-platform method to construct a path, is to construct one from components. For example os.path.join is a well known way to do so in Python.
In Rust is not as obvious how to do that in a convenient manner. You could push components one-by-one into a PathBuf, but that sounds sort of inconvenient. There’s a
impl<P: AsRef<Path>> FromIterator<P> for PathBuf
implementation exactly for that, but it is extremely difficult to discover. Perhaps what we need is a in-your-face example on PathBuf that explains the only really correct way to construct a multi-component PathBuf?
The only really cross-platform method to construct a path, is to construct one from components. For example
os.path.joinis a well known way to do so in Python.In Rust is not as obvious how to do that in a convenient manner. You could
pushcomponents one-by-one into aPathBuf, but that sounds sort of inconvenient. There’s aimplementation exactly for that, but it is extremely difficult to discover. Perhaps what we need is a in-your-face example on
PathBufthat explains the only really correct way to construct a multi-component PathBuf?