-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should Utf8PathBuf::from_path_buf return a real error? #6
Comments
Hey, thanks for the report and for checking out camino! So I went back and forth on the definition of this for a while, eventually settling on matching For your use case, do you think you could write your own freestanding function (or extension trait) for now which wraps |
I actually reached for
Mmmmaaaaayyybbeee? The problem is that we have a workspace with a bunch of different subcrates that all have their own |
Ah, hmm, yeah. One way might be to define a crate + error type that sits at the bottom of your dependency graph, have it return an error, then use thiserror's automatic I do agree that solving this is probably worth it, and I'm inclined to pursue the |
This will be fixed in 1.0.3, which is about to go out to crates.io. Thanks for the report! |
And released :) |
Hi!
I just opened a PR that introduces camino to the tool I'm working on, and I seem to be relying on
Utf8PathBuf::from_path_buf
quite a bit when interacting withstd::path::PathBuf
s coming from places likestd::env::current_dir
.I'd love to just use
?
like I would any other fallible function that returns aResult
type, but it seems thatUtf8PathBuf::from_path_buf
returns aResult<Utf8PathBuf, PathBuf>
which requires me to write.map_err
every time I call it.Am I doing something wrong here? Is there a better way to do these conversions that I'm missing? If not, it seems like that
Result
type should implementstd::error::Error
and possibly wrap the oldPathBuf
up in it.Love the library! Thanks for all of the work you've put in to make it a reality 😄
The text was updated successfully, but these errors were encountered: