-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Hey there, excellent library. I'm wondering if there is a recommended way to convert back and forth between the std::path::Path and std::path::PathBuf types.
It's nice to store types as Utf8NativePath, because that has an AsRef<std::path::Path>. That type can easily be passed into other libraries that expect the std path types.
However, it seems quite cumbersome to create that from an std path:
let native_path = Utf8NativePath::from_bytes_path(NativePath::new(
std_path.as_os_str().as_encoded_bytes(),
))
.expect("Path did not contain valid UTF-8 characters");
It seems to me that NativePath should have a From<std::path::Path>, since from_bytes_path is is infallable, and Utf8NativePath should have a fallable TryFrom<std::path::Path> with Utf8Error.
The library does an amazing job documenting and interopting with itself, but much of the Rust ecosystem uses std path, so I find this library hard to work with practically. Perhaps I missed something obvious?
Thanks for your time!