I have the following function signature:
fn output_dir<'a, T: Into<Cow<'a, Path>>>(output_dir: T);
And I want to be able to pass in a
&str. However, I am getting the error:
the trait `std::convert::From<&str>` is not implemented for `std::borrow::Cow<'_, std::path::Path>`
So this immediately leads to the question: if I can convert a
&str into a
Path, why can I not turn this easily into a
It looks like we don’t have a blanket impl for this kind of thing, e.g. something like:
impl<'a, T, U> From<T> for Cow<'a, U> where T: AsRef<U>
Is there some alternative to this that I am not thinking of?
Would it be interesting to have an RFC to include this in stdlib?