Hello! Thanks for your great work! I've used this in several scenarios, but I have a trait Equiv, which compares enums by each variant. It's like below:
trait Equiv {
fn equiv(&self, other: &Self) -> bool;
}
Given an enum with the most common usage of derive_recursive below:
#[derive(Recursive)]
#[recursive(
impl<T: Equiv, U: Equiv> Equiv for Self<T, U> {
fn equiv(&self, other: &Self) -> bool { aggregate = && }
}
)]
enum Either<T, U> {
Left(T),
Right(U),
}
It will be compiled to:
impl<T: Equiv, U: Equiv> Equiv for Either<T, U> {
fn equiv(&self, arg0: &Self) -> bool {
match self {
Self::Left(f0) => <T as Equiv>::equiv(f0, arg0),
Self::Right(f0) => <U as Equiv>::equiv(f0, arg0),
}
}
}
However, <T as Equiv>::equiv accepts 2 arguments of &T, but not 1 argument of &T and 1 argument of &Either<T, U>.
Is there a way to implement this trait correctly in current version?
Hello! Thanks for your great work! I've used this in several scenarios, but I have a trait
Equiv, which comparesenums by each variant. It's like below:Given an
enumwith the most common usage of derive_recursive below:It will be compiled to:
However,
<T as Equiv>::equivaccepts 2 arguments of&T, but not 1 argument of&Tand 1 argument of&Either<T, U>.Is there a way to implement this trait correctly in current version?