Why do I get an error compiling these impls? (error[E0119]: conflicting implementations of trait apply::Apply<_>
for type &_
: )
impl<F, I, R, E> Apply<I> for F
where
F: Fn(I) -> Result<R, E>,
{
type Err = E;
type Res = R;
fn apply(&self, input: I) -> Result<Self::Res, Self::Err> { self(input) }
}
impl<T, I> Apply<I> for &T
where
T: Apply<I> + ?Sized,
{
type Err = T::Err;
type Res = T::Res;
fn apply(&self, input: I) -> Result<Self::Res, Self::Err> { (**self).apply(input) }
}
I know that I can get around this, for example by wrapping a type. But I wonder why these impl conflict. Is &_ not a type wrapper in itself?