Comments (5)
Mmmmaaaaayyybbeee? The problem is that we have a workspace with a bunch of different subcrates that all have their own thiserror enums. I've added an error type to that enum, but still need to call map_err to create that other error type. Not sure how I would do it in a more seamless way. (It totally works as is so I'll probably just leave it until a possible try_from appears.
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 From
conversion. But that's probably messier than just solving it in camino.
I do agree that solving this is probably worth it, and I'm inclined to pursue the TryFrom
solution -- I think it'll likely work. I'll leave this open for a bit for more feedback from other users.
from camino.
This will be fixed in 1.0.3, which is about to go out to crates.io. Thanks for the report!
from camino.
And released :)
from camino.
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 OsString::into_string
(which is morally equivalent to this method). However, I do see the argument for having a proper error type with the option of converting it into a PathBuf
. It's too late to change the definition of from_path_buf
itself now, but one could in principle add a different method -- perhaps a TryFrom<PathBuf> for Utf8PathBuf
impl -- which returns an error type. What do you think? Would love some more feedback about this approach.
For your use case, do you think you could write your own freestanding function (or extension trait) for now which wraps Utf8PathBuf::from_path_buf
+ map_err
into your own error type?
from camino.
I actually reached for try_from
initially so I think that makes total sense!
For your use case, do you think you could write your own freestanding function (or extension trait) for now which wraps Utf8PathBuf::from_path_buf + map_err into your own error type?
Mmmmaaaaayyybbeee? The problem is that we have a workspace with a bunch of different subcrates that all have their own thiserror
enums. I've added an error type to that enum, but still need to call map_err
to create that other error type. Not sure how I would do it in a more seamless way. (It totally works as is so I'll probably just leave it until a possible try_from
appears.
from camino.
Related Issues (15)
- `AsRef<Path>` instead of `AsRef<Self>` in `Utf8Path::starts_with`? HOT 2
- Gauging level of interest in using simdutf8 HOT 8
- read_dir() throws me back into std::path::Path HOT 3
- New version 1.1.0 fails to compile HOT 8
- Add Utf8Path::as_std_path()
- Feature request: `Cow<'a, str>` conversions HOT 1
- Feature request: `Utf8DirEntry` to `Utf8PathBuf` HOT 2
- Implement DerefMut for Utf8PathBuf HOT 1
- Implement Deserialize/Serialize for Box<Utf8Path>
- Maybe it's better to add Utf8PathBuf::as_std_pathbuf, and Utf8PathBuf::as_std_path? HOT 4
- What's with the `serde1` and `proptest1` features? HOT 5
- Compilation error when calling `Utf8Path::try_from` on an `std::path::Path` HOT 2
- Hash implementation of Utf8PathBuf doesn't match Utf8Path HOT 2
- impl JsonSchema on Utf8Path[Buf] HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from camino.