toolu_orm_query/
tuple_append.rs1pub trait TupleAppend<T> {
9 type Output;
11 fn append(self, value: T) -> Self::Output;
13}
14
15macro_rules! impl_tuple_append_for {
16 (($($T:ident),+), ($($idx:tt),+)) => {
17 impl<$($T,)* Appended> TupleAppend<Appended> for ($($T,)+) {
18 type Output = ($($T,)+ Appended);
19
20 fn append(self, value: Appended) -> Self::Output {
21 ($(self.$idx,)+ value)
22 }
23 }
24 };
25}
26
27impl_tuple_append_for!((A), (0));
28impl_tuple_append_for!((A, B), (0, 1));
29impl_tuple_append_for!((A, B, C), (0, 1, 2));
30impl_tuple_append_for!((A, B, C, D), (0, 1, 2, 3));
31impl_tuple_append_for!((A, B, C, D, E), (0, 1, 2, 3, 4));
32impl_tuple_append_for!((A, B, C, D, E, F), (0, 1, 2, 3, 4, 5));
33impl_tuple_append_for!((A, B, C, D, E, F, G), (0, 1, 2, 3, 4, 5, 6));
34impl_tuple_append_for!((A, B, C, D, E, F, G, H), (0, 1, 2, 3, 4, 5, 6, 7));