@@ -737,7 +737,7 @@ impl<I: Iterator> HasCombination<I> for (I::Item,) {
737
737
}
738
738
739
739
macro_rules! impl_tuple_combination {
740
- ( $C: ident $P: ident ; $A : ident , $ ( $I : ident ) , * ; $ ( $X: ident) * ) => (
740
+ ( $C: ident $P: ident ; $( $X: ident) * ) => (
741
741
#[ derive( Clone , Debug ) ]
742
742
pub struct $C<I : Iterator > {
743
743
item: Option <I :: Item >,
@@ -766,11 +766,11 @@ macro_rules! impl_tuple_combination {
766
766
}
767
767
}
768
768
769
- impl <I , $ A> Iterator for $C<I >
770
- where I : Iterator <Item = $ A> + Clone ,
769
+ impl <I , A > Iterator for $C<I >
770
+ where I : Iterator <Item = A > + Clone ,
771
771
I :: Item : Clone
772
772
{
773
- type Item = ( $ ( $I ) ,* ) ;
773
+ type Item = ( A , $ ( ignore_ident! ( $X , A ) ) ,* ) ;
774
774
775
775
fn next( & mut self ) -> Option <Self :: Item > {
776
776
if let Some ( ( $( $X) ,* , ) ) = self . c. next( ) {
@@ -786,8 +786,8 @@ macro_rules! impl_tuple_combination {
786
786
}
787
787
}
788
788
789
- impl <I , $ A> HasCombination <I > for ( $ ( $I ) ,* )
790
- where I : Iterator <Item = $ A> + Clone ,
789
+ impl <I , A > HasCombination <I > for ( A , $ ( ignore_ident! ( $X , A ) ) ,* )
790
+ where I : Iterator <Item = A > + Clone ,
791
791
I :: Item : Clone
792
792
{
793
793
type Combination = $C<Fuse <I >>;
@@ -800,25 +800,24 @@ macro_rules! impl_tuple_combination {
800
800
// use itertools::Itertools;
801
801
//
802
802
// for i in 2..=12 {
803
- // println!("impl_tuple_combination!(Tuple{arity}Combination Tuple{prev}Combination; {tys}; { idents});",
803
+ // println!("impl_tuple_combination!(Tuple{arity}Combination Tuple{prev}Combination; {idents});",
804
804
// arity = i,
805
805
// prev = i - 1,
806
- // tys = iter::repeat("A").take(i + 1).join(", "),
807
806
// idents = ('a'..'z').take(i - 1).join(" "),
808
807
// );
809
808
// }
810
809
// It could probably be replaced by a bit more macro cleverness.
811
- impl_tuple_combination ! ( Tuple2Combination Tuple1Combination ; A , A , A ; a) ;
812
- impl_tuple_combination ! ( Tuple3Combination Tuple2Combination ; A , A , A , A ; a b) ;
813
- impl_tuple_combination ! ( Tuple4Combination Tuple3Combination ; A , A , A , A , A ; a b c) ;
814
- impl_tuple_combination ! ( Tuple5Combination Tuple4Combination ; A , A , A , A , A , A ; a b c d) ;
815
- impl_tuple_combination ! ( Tuple6Combination Tuple5Combination ; A , A , A , A , A , A , A ; a b c d e) ;
816
- impl_tuple_combination ! ( Tuple7Combination Tuple6Combination ; A , A , A , A , A , A , A , A ; a b c d e f) ;
817
- impl_tuple_combination ! ( Tuple8Combination Tuple7Combination ; A , A , A , A , A , A , A , A , A ; a b c d e f g) ;
818
- impl_tuple_combination ! ( Tuple9Combination Tuple8Combination ; A , A , A , A , A , A , A , A , A , A ; a b c d e f g h) ;
819
- impl_tuple_combination ! ( Tuple10Combination Tuple9Combination ; A , A , A , A , A , A , A , A , A , A , A ; a b c d e f g h i) ;
820
- impl_tuple_combination ! ( Tuple11Combination Tuple10Combination ; A , A , A , A , A , A , A , A , A , A , A , A ; a b c d e f g h i j) ;
821
- impl_tuple_combination ! ( Tuple12Combination Tuple11Combination ; A , A , A , A , A , A , A , A , A , A , A , A , A ; a b c d e f g h i j k) ;
810
+ impl_tuple_combination ! ( Tuple2Combination Tuple1Combination ; a) ;
811
+ impl_tuple_combination ! ( Tuple3Combination Tuple2Combination ; a b) ;
812
+ impl_tuple_combination ! ( Tuple4Combination Tuple3Combination ; a b c) ;
813
+ impl_tuple_combination ! ( Tuple5Combination Tuple4Combination ; a b c d) ;
814
+ impl_tuple_combination ! ( Tuple6Combination Tuple5Combination ; a b c d e) ;
815
+ impl_tuple_combination ! ( Tuple7Combination Tuple6Combination ; a b c d e f) ;
816
+ impl_tuple_combination ! ( Tuple8Combination Tuple7Combination ; a b c d e f g) ;
817
+ impl_tuple_combination ! ( Tuple9Combination Tuple8Combination ; a b c d e f g h) ;
818
+ impl_tuple_combination ! ( Tuple10Combination Tuple9Combination ; a b c d e f g h i) ;
819
+ impl_tuple_combination ! ( Tuple11Combination Tuple10Combination ; a b c d e f g h i j) ;
820
+ impl_tuple_combination ! ( Tuple12Combination Tuple11Combination ; a b c d e f g h i j k) ;
822
821
823
822
/// An iterator adapter to filter values within a nested `Result::Ok`.
824
823
///
0 commit comments