@@ -248,10 +248,13 @@ macro_rules! count_ident{
248
248
( ) => { 0 } ;
249
249
( $i0: ident, $( $i: ident, ) * ) => { 1 + count_ident!( $( $i, ) * ) } ;
250
250
}
251
+ macro_rules! ignore_ident{
252
+ ( $id: ident, $( $t: tt) * ) => { $( $t) * } ;
253
+ }
251
254
252
255
macro_rules! impl_tuple_collect {
253
- ( $( $X : ident ) , * ; $ ( $ Y: ident) ,* ; $( $Y_rev: ident) ,* ) => (
254
- impl <A > TupleCollect for ( $( $X ) , * , ) {
256
+ ( $( $Y: ident) ,* ; $( $Y_rev: ident) ,* ) => (
257
+ impl <A > TupleCollect for ( $( ignore_ident! ( $Y , A ) , ) * ) {
255
258
type Item = A ;
256
259
type Buffer = [ Option <A >; count_ident!( $( $Y, ) * ) - 1 ] ;
257
260
@@ -317,22 +320,21 @@ macro_rules! impl_tuple_collect {
317
320
// use itertools::Itertools;
318
321
//
319
322
// for i in 1..=12 {
320
- // println!("impl_tuple_collect!({ty}; {idents}; {rev_idents});",
321
- // ty=iter::repeat("A").take(i).join(", "),
323
+ // println!("impl_tuple_collect!({idents}; {rev_idents});",
322
324
// idents=('a'..='z').take(i).join(", "),
323
325
// rev_idents=('a'..='z').take(i).collect_vec().into_iter().rev().join(", ")
324
326
// );
325
327
// }
326
328
// It could probably be replaced by a bit more macro cleverness.
327
- impl_tuple_collect ! ( A ; a; a) ;
328
- impl_tuple_collect ! ( A , A ; a, b; b, a) ;
329
- impl_tuple_collect ! ( A , A , A ; a, b, c; c, b, a) ;
330
- impl_tuple_collect ! ( A , A , A , A ; a, b, c, d; d, c, b, a) ;
331
- impl_tuple_collect ! ( A , A , A , A , A ; a, b, c, d, e; e, d, c, b, a) ;
332
- impl_tuple_collect ! ( A , A , A , A , A , A ; a, b, c, d, e, f; f, e, d, c, b, a) ;
333
- impl_tuple_collect ! ( A , A , A , A , A , A , A ; a, b, c, d, e, f, g; g, f, e, d, c, b, a) ;
334
- impl_tuple_collect ! ( A , A , A , A , A , A , A , A ; a, b, c, d, e, f, g, h; h, g, f, e, d, c, b, a) ;
335
- impl_tuple_collect ! ( A , A , A , A , A , A , A , A , A ; a, b, c, d, e, f, g, h, i; i, h, g, f, e, d, c, b, a) ;
336
- impl_tuple_collect ! ( A , A , A , A , A , A , A , A , A , A ; a, b, c, d, e, f, g, h, i, j; j, i, h, g, f, e, d, c, b, a) ;
337
- impl_tuple_collect ! ( A , A , A , A , A , A , A , A , A , A , A ; a, b, c, d, e, f, g, h, i, j, k; k, j, i, h, g, f, e, d, c, b, a) ;
338
- impl_tuple_collect ! ( A , A , A , A , A , A , A , A , A , A , A , A ; a, b, c, d, e, f, g, h, i, j, k, l; l, k, j, i, h, g, f, e, d, c, b, a) ;
329
+ impl_tuple_collect ! ( a; a) ;
330
+ impl_tuple_collect ! ( a, b; b, a) ;
331
+ impl_tuple_collect ! ( a, b, c; c, b, a) ;
332
+ impl_tuple_collect ! ( a, b, c, d; d, c, b, a) ;
333
+ impl_tuple_collect ! ( a, b, c, d, e; e, d, c, b, a) ;
334
+ impl_tuple_collect ! ( a, b, c, d, e, f; f, e, d, c, b, a) ;
335
+ impl_tuple_collect ! ( a, b, c, d, e, f, g; g, f, e, d, c, b, a) ;
336
+ impl_tuple_collect ! ( a, b, c, d, e, f, g, h; h, g, f, e, d, c, b, a) ;
337
+ impl_tuple_collect ! ( a, b, c, d, e, f, g, h, i; i, h, g, f, e, d, c, b, a) ;
338
+ impl_tuple_collect ! ( a, b, c, d, e, f, g, h, i, j; j, i, h, g, f, e, d, c, b, a) ;
339
+ impl_tuple_collect ! ( a, b, c, d, e, f, g, h, i, j, k; k, j, i, h, g, f, e, d, c, b, a) ;
340
+ impl_tuple_collect ! ( a, b, c, d, e, f, g, h, i, j, k, l; l, k, j, i, h, g, f, e, d, c, b, a) ;
0 commit comments