-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,24 +14,28 @@ pub trait EqAll<Rhs> { | |
fn eq_all(self, rhs: Rhs) -> Self::Output; | ||
} | ||
|
||
impl<L1, L2, LTail, R1, R2, RTail> EqAll<Cons<R1, Cons<R2, RTail>>> | ||
for Cons<L1, Cons<L2, LTail>> where | ||
impl<L1, L2, LTail, R1, R2, RTail> EqAll<(R1, R2, ...RTail)> | ||
for (L1, L2, ...LTail) where | ||
L1: EqAll<R1>, | ||
Cons<L2, LTail>: EqAll<Cons<R2, RTail>>, | ||
(L2, ...LTail): EqAll<(R2, ...RTail)>, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
sgrif
Author
Member
|
||
LTail: Tuple, | ||
RTail: Tuple, | ||
{ | ||
type Output = And<<L1 as EqAll<R1>>::Output, <Cons<L2, LTail> as EqAll<Cons<R2, RTail>>>::Output>; | ||
type Output = And<<L1 as EqAll<R1>>::Output, <(L1, ...LTail) as EqAll<(R1, ...RTail)>>::Output>; | ||
|
||
fn eq_all(self, rhs: Cons<R1, Cons<R2, RTail>>) -> Self::Output { | ||
self.0.eq_all(rhs.0).and(self.1.eq_all(rhs.1)) | ||
fn eq_all(self, rhs: (R1, R2, ...RTail)) -> Self::Output { | ||
let (lhead, ...ltail) = self; | ||
let (rhead, ...rtail) = rhs; | ||
lhead.eq_all(rhead).and(ltail.eq_all(rtail)) | ||
} | ||
} | ||
|
||
impl<Left, Right> EqAll<Cons<Right, Nil>> for Cons<Left, Nil> where | ||
impl<Left, Right> EqAll<(Right,)> for Cons<(Left,)> where | ||
Left: EqAll<Right>, | ||
{ | ||
type Output = <Left as EqAll<Right>>::Output; | ||
|
||
fn eq_all(self, rhs: Cons<Right, Nil>) -> Self::Output { | ||
fn eq_all(self, rhs: (Right,)) -> Self::Output { | ||
self.0.eq_all(rhs.0) | ||
} | ||
} |
Why isn't this
LTail: EqAll<RTail>
, i.e. why is there more than one head being eaten in thisimpl
?