I've got struct Foo<T>
and I'd like to make it possible to convert between all variants of this struct as long as T
can be converted.
impl<T, U> From<Foo<U>> for Foo<T> where T: From<U> {
fn from(other: Foo<U>) -> Self {
Foo{
foo:other.foo.into(),
}
}
}
However, this doesn't compile:
error: conflicting implementations of trait
std::convert::From<Foo<_>>
for typeFoo<_>
note: conflicting implementation in cratecore
I guess it's because core has a no-op version for T
-> T
conversion. How can I exclude that one from my implementation?