Open indygreg opened 1 year ago
Thanks for the kind words!
Sadly that isn't possible via From
directly:
error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate
--> src/lib.rs:2253:1
|
2253 | impl<'a> From<Cow<'a, str>> for Cow<'a, Utf8Path> {
| ^^^^^^^^^------------------^^^^^-----------------
| | | |
| | | `Cow` is not defined in the current crate
| | `Cow` is not defined in the current crate
| impl doesn't use only types from inside the current crate
|
= note: define and implement a trait or new type instead
For more information about this error, try `rustc --explain E0117`.
error: could not compile `camino` due to previous error
I guess we could add explicit methods to do this. Not sure what to call them.
Thanks for this terrific crate!
I found myself needing to convert between
Cow<'a, str>
andCow<'a, Utf8Path>
. This is a bit awkward with the current crate APIs because you need to explicitly construct aCow
orUtf8Path
/Utf8PathBuf
at the call site. I'd prefer to e.g. just.into()
on aCow<'a, str>
to get aCow<'a, Utf8Path>
.What do you think about adding explicit
Cow<'a, str>
type conversions toUtf8Path
andUtf8PathBuf
?