Skip to main content

enso_generics/
tuple.rs

1//! This module contains implementations of generic operations on tuples.
2
3use crate as hlist;
4use nalgebra::base::dimension::*;
5
6
7
8// ====================
9// === HasTupleRepr ===
10// ====================
11
12/// All types which have a tuple representation.
13#[allow(missing_docs)]
14pub trait HasTupleRepr {
15    type TupleRepr;
16}
17
18/// Tuple representation of a type.
19pub type TupleRepr<T> = <T as HasTupleRepr>::TupleRepr;
20
21/// Conversion of the given type to its tuple representation.
22#[allow(missing_docs)]
23pub trait IntoTuple : HasTupleRepr + Into<TupleRepr<Self>> {
24    fn into_tuple(self) -> TupleRepr<Self> {
25        self.into()
26    }
27}
28
29impl<T> IntoTuple for T where T : HasTupleRepr + Into<TupleRepr<T>> {}
30
31
32
33// ===================
34// === GenericRepr ===
35// ===================
36
37macro_rules! gen_as_hlist_for_tuples {
38    () => {};
39    ($t:ident $(,$($ts:ident),*)?) => {
40        impl <$($($ts),*)?> $crate::HasRepr for ($($($ts,)*)?) {
41            type GenericRepr = hlist::ty! { $($($ts),*)? };
42        }
43        gen_as_hlist_for_tuples! { $($($ts),*)? }
44    }
45}
46
47gen_as_hlist_for_tuples! {T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12}
48
49
50
51
52// =============================
53// === KnownLast / KnownInit ===
54// =============================
55
56macro_rules! gen_known_last {
57    () => {};
58    ($t:ident $(,$($ts:ident),*)?) => {
59        impl<X $(,$($ts),*)?> $crate::KnownLast for ($($($ts,)*)? X,) { type Last = X; }
60        gen_known_last! { $($($ts),*)? }
61    }
62}
63
64macro_rules! gen_known_init {
65    () => {};
66    ($t:ident $(,$($ts:ident),*)?) => {
67        impl<X $(,$($ts),*)?> $crate::KnownInit for ($($($ts,)*)? X,) { type Init = ($($($ts,)*)?); }
68        gen_known_init! { $($($ts),*)? }
69    }
70}
71
72gen_known_last!{T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11}
73gen_known_init!{T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11}
74
75
76
77
78// ================
79// === PushBack ===
80// ================
81
82impl<X> hlist::PushBack<X>
83for () {
84    type Output = (X,);
85    fn push_back(self,x:X) -> Self::Output {
86        (x,)
87    }
88}
89
90impl<X,T0> hlist::PushBack<X>
91for (T0,) {
92    type Output = (T0,X);
93    fn push_back(self,x:X) -> Self::Output {
94        (self.0,x)
95    }
96}
97
98impl<X,T0,T1> hlist::PushBack<X>
99for (T0,T1) {
100    type Output = (T0,T1,X);
101    fn push_back(self,x:X) -> Self::Output {
102        (self.0,self.1,x)
103    }
104}
105
106impl<X,T0,T1,T2> hlist::PushBack<X>
107for (T0,T1,T2) {
108    type Output = (T0,T1,T2,X);
109    fn push_back(self,x:X) -> Self::Output {
110        (self.0,self.1,self.2,x)
111    }
112}
113
114impl<X,T0,T1,T2,T3> hlist::PushBack<X>
115for (T0,T1,T2,T3) {
116    type Output = (T0,T1,T2,T3,X);
117    fn push_back(self,x:X) -> Self::Output {
118        (self.0,self.1,self.2,self.3,x)
119    }
120}
121
122impl<X,T0,T1,T2,T3,T4> hlist::PushBack<X>
123for (T0,T1,T2,T3,T4) {
124    type Output = (T0,T1,T2,T3,T4,X);
125    fn push_back(self,x:X) -> Self::Output {
126        (self.0,self.1,self.2,self.3,self.4,x)
127    }
128}
129
130impl<X,T0,T1,T2,T3,T4,T5> hlist::PushBack<X>
131for (T0,T1,T2,T3,T4,T5) {
132    type Output = (T0,T1,T2,T3,T4,T5,X);
133    fn push_back(self,x:X) -> Self::Output {
134        (self.0,self.1,self.2,self.3,self.4,self.5,x)
135    }
136}
137
138impl<X,T0,T1,T2,T3,T4,T5,T6> hlist::PushBack<X>
139for (T0,T1,T2,T3,T4,T5,T6) {
140    type Output = (T0,T1,T2,T3,T4,T5,T6,X);
141    fn push_back(self,x:X) -> Self::Output {
142        (self.0,self.1,self.2,self.3,self.4,self.5,self.6,x)
143    }
144}
145
146impl<X,T0,T1,T2,T3,T4,T5,T6,T7> hlist::PushBack<X>
147for (T0,T1,T2,T3,T4,T5,T6,T7) {
148    type Output = (T0,T1,T2,T3,T4,T5,T6,T7,X);
149    fn push_back(self,x:X) -> Self::Output {
150        (self.0,self.1,self.2,self.3,self.4,self.5,self.6,self.7,x)
151    }
152}
153
154impl<X,T0,T1,T2,T3,T4,T5,T6,T7,T8> hlist::PushBack<X>
155for (T0,T1,T2,T3,T4,T5,T6,T7,T8) {
156    type Output = (T0,T1,T2,T3,T4,T5,T6,T7,T8,X);
157    fn push_back(self,x:X) -> Self::Output {
158        (self.0,self.1,self.2,self.3,self.4,self.5,self.6,self.7,self.8,x)
159    }
160}
161
162impl<X,T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> hlist::PushBack<X>
163for (T0,T1,T2,T3,T4,T5,T6,T7,T8,T9) {
164    type Output = (T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,X);
165    fn push_back(self,x:X) -> Self::Output {
166        (self.0,self.1,self.2,self.3,self.4,self.5,self.6,self.7,self.8,self.9,x)
167    }
168}
169
170impl<X,T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> hlist::PushBack<X>
171for (T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10) {
172    type Output = (T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,X);
173    fn push_back(self,x:X) -> Self::Output {
174        (self.0,self.1,self.2,self.3,self.4,self.5,self.6,self.7,self.8,self.9,self.10,x)
175    }
176}
177
178
179
180
181// ===============
182// === PopBack ===
183// ===============
184
185impl<T0> hlist::PopBack
186for (T0,) {
187    fn pop_back(self) -> (Self::Last,Self::Init) {
188        (self.0,())
189    }
190}
191
192impl<T0,T1> hlist::PopBack
193for (T0,T1) {
194    fn pop_back(self) -> (Self::Last,Self::Init) {
195        (self.1,(self.0,))
196    }
197}
198
199impl<T0,T1,T2> hlist::PopBack
200for (T0,T1,T2) {
201    fn pop_back(self) -> (Self::Last,Self::Init) {
202        (self.2,(self.0,self.1))
203    }
204}
205
206impl<T0,T1,T2,T3> hlist::PopBack
207for (T0,T1,T2,T3) {
208    fn pop_back(self) -> (Self::Last,Self::Init) {
209        (self.3,(self.0,self.1,self.2))
210    }
211}
212
213impl<T0,T1,T2,T3,T4> hlist::PopBack
214for (T0,T1,T2,T3,T4) {
215    fn pop_back(self) -> (Self::Last,Self::Init) {
216        (self.4,(self.0,self.1,self.2,self.3))
217    }
218}
219
220impl<T0,T1,T2,T3,T4,T5> hlist::PopBack
221for (T0,T1,T2,T3,T4,T5) {
222    fn pop_back(self) -> (Self::Last,Self::Init) {
223        (self.5,(self.0,self.1,self.2,self.3,self.4))
224    }
225}
226
227impl<T0,T1,T2,T3,T4,T5,T6> hlist::PopBack
228for (T0,T1,T2,T3,T4,T5,T6) {
229    fn pop_back(self) -> (Self::Last,Self::Init) {
230        (self.6,(self.0,self.1,self.2,self.3,self.4,self.5))
231    }
232}
233
234impl<T0,T1,T2,T3,T4,T5,T6,T7> hlist::PopBack
235for (T0,T1,T2,T3,T4,T5,T6,T7) {
236    fn pop_back(self) -> (Self::Last,Self::Init) {
237        (self.7,(self.0,self.1,self.2,self.3,self.4,self.5,self.6))
238    }
239}
240
241impl<T0,T1,T2,T3,T4,T5,T6,T7,T8> hlist::PopBack
242for (T0,T1,T2,T3,T4,T5,T6,T7,T8) {
243    fn pop_back(self) -> (Self::Last,Self::Init) {
244        (self.8,(self.0,self.1,self.2,self.3,self.4,self.5,self.6,self.7))
245    }
246}
247
248impl<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> hlist::PopBack
249for (T0,T1,T2,T3,T4,T5,T6,T7,T8,T9) {
250    fn pop_back(self) -> (Self::Last,Self::Init) {
251        (self.9,(self.0,self.1,self.2,self.3,self.4,self.5,self.6,self.7,self.8))
252    }
253}
254
255impl<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> hlist::PopBack
256for (T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10) {
257    fn pop_back(self) -> (Self::Last,Self::Init) {
258        (self.10,(self.0,self.1,self.2,self.3,self.4,self.5,self.6,self.7,self.8,self.9))
259    }
260}
261
262impl<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> hlist::PopBack
263for (T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11) {
264    fn pop_back(self) -> (Self::Last,Self::Init) {
265        (self.11,(self.0,self.1,self.2,self.3,self.4,self.5,self.6,self.7,self.8,self.9,self.10))
266    }
267}
268
269
270
271// =================================
272// === Conversion Tuple -> HList ===
273// =================================
274
275impl From<()>
276for hlist::ty![] {
277    #[inline(always)]
278    fn from(_:()) -> Self {
279        hlist::new![]
280    }
281}
282
283impl<T0> From<(T0,)>
284for hlist::ty![T0] {
285    #[inline(always)]
286    fn from(t:(T0,)) -> Self {
287        hlist::new![t.0]
288    }
289}
290
291impl<T0,T1> From<(T0,T1,)>
292for hlist::ty![T0,T1] {
293    #[inline(always)]
294    fn from(t:(T0,T1,)) -> Self {
295        hlist::new![t.0,t.1]
296    }
297}
298
299impl<T0,T1,T2> From<(T0,T1,T2,)>
300for hlist::ty![T0,T1,T2] {
301    #[inline(always)]
302    fn from(t:(T0,T1,T2,)) -> Self {
303        hlist::new![t.0,t.1,t.2]
304    }
305}
306
307impl<T0,T1,T2,T3> From<(T0,T1,T2,T3,)>
308for hlist::ty![T0,T1,T2,T3] {
309    #[inline(always)]
310    fn from(t:(T0,T1,T2,T3,)) -> Self {
311        hlist::new![t.0,t.1,t.2,t.3]
312    }
313}
314
315impl<T0,T1,T2,T3,T4> From<(T0,T1,T2,T3,T4,)>
316for hlist::ty![T0,T1,T2,T3,T4] {
317    #[inline(always)]
318    fn from(t:(T0,T1,T2,T3,T4,)) -> Self {
319        hlist::new![t.0,t.1,t.2,t.3,t.4]
320    }
321}
322
323impl<T0,T1,T2,T3,T4,T5> From<(T0,T1,T2,T3,T4,T5,)>
324for hlist::ty![T0,T1,T2,T3,T4,T5] {
325    #[inline(always)]
326    fn from(t:(T0,T1,T2,T3,T4,T5,)) -> Self {
327        hlist::new![t.0,t.1,t.2,t.3,t.4,t.5]
328    }
329}
330
331impl<T0,T1,T2,T3,T4,T5,T6> From<(T0,T1,T2,T3,T4,T5,T6,)>
332for hlist::ty![T0,T1,T2,T3,T4,T5,T6] {
333    #[inline(always)]
334    fn from(t:(T0,T1,T2,T3,T4,T5,T6,)) -> Self {
335        hlist::new![t.0,t.1,t.2,t.3,t.4,t.5,t.6]
336    }
337}
338
339impl<T0,T1,T2,T3,T4,T5,T6,T7> From<(T0,T1,T2,T3,T4,T5,T6,T7,)>
340for hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7] {
341    #[inline(always)]
342    fn from(t:(T0,T1,T2,T3,T4,T5,T6,T7,)) -> Self {
343        hlist::new![t.0,t.1,t.2,t.3,t.4,t.5,t.6,t.7]
344    }
345}
346
347impl<T0,T1,T2,T3,T4,T5,T6,T7,T8> From<(T0,T1,T2,T3,T4,T5,T6,T7,T8,)>
348for hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7,T8] {
349    #[inline(always)]
350    fn from(t:(T0,T1,T2,T3,T4,T5,T6,T7,T8,)) -> Self {
351        hlist::new![t.0,t.1,t.2,t.3,t.4,t.5,t.6,t.7,t.8]
352    }
353}
354
355impl<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> From<(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,)>
356for hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7,T8,T9] {
357    #[inline(always)]
358    fn from(t:(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,)) -> Self {
359        hlist::new![t.0,t.1,t.2,t.3,t.4,t.5,t.6,t.7,t.8,t.9]
360    }
361}
362
363impl<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> From<(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,)>
364for hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10] {
365    #[inline(always)]
366    fn from(t:(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,)) -> Self {
367        hlist::new![t.0,t.1,t.2,t.3,t.4,t.5,t.6,t.7,t.8,t.9,t.10]
368    }
369}
370
371impl<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> From<(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,)>
372for hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11] {
373    #[inline(always)]
374    fn from(t:(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,)) -> Self {
375        hlist::new![t.0,t.1,t.2,t.3,t.4,t.5,t.6,t.7,t.8,t.9,t.10,t.11]
376    }
377}
378
379
380
381
382// =================================
383// === Conversion HList -> Tuple ===
384// =================================
385
386impl From<hlist::ty![]>
387for () {
388    #[inline(always)]
389    fn from(_:hlist::ty![]) -> Self {}
390}
391
392impl<T0> From<hlist::ty![T0]>
393for (T0,) {
394    #[inline(always)]
395    fn from(value:hlist::ty![T0,]) -> Self {
396        let hlist::pat![t0] = value;
397        (t0,)
398    }
399}
400
401impl<T0,T1> From<hlist::ty![T0,T1]>
402for (T0,T1) {
403    #[inline(always)]
404    fn from(value:hlist::ty![T0,T1]) -> Self {
405        let hlist::pat![t0,t1] = value;
406        (t0,t1)
407    }
408}
409
410impl<T0,T1,T2> From<hlist::ty![T0,T1,T2]>
411for (T0,T1,T2) {
412    #[inline(always)]
413    fn from(value:hlist::ty![T0,T1,T2]) -> Self {
414        let hlist::pat![t0,t1,t2] = value;
415        (t0,t1,t2)
416    }
417}
418
419impl<T0,T1,T2,T3> From<hlist::ty![T0,T1,T2,T3]>
420for (T0,T1,T2,T3) {
421    #[inline(always)]
422    fn from(value:hlist::ty![T0,T1,T2,T3]) -> Self {
423        let hlist::pat![t0,t1,t2,t3] = value;
424        (t0,t1,t2,t3)
425    }
426}
427
428impl<T0,T1,T2,T3,T4> From<hlist::ty![T0,T1,T2,T3,T4]>
429for (T0,T1,T2,T3,T4) {
430    #[inline(always)]
431    fn from(value:hlist::ty![T0,T1,T2,T3,T4]) -> Self {
432        let hlist::pat![t0,t1,t2,t3,t4] = value;
433        (t0,t1,t2,t3,t4)
434    }
435}
436
437impl<T0,T1,T2,T3,T4,T5> From<hlist::ty![T0,T1,T2,T3,T4,T5]>
438for (T0,T1,T2,T3,T4,T5) {
439    #[inline(always)]
440    fn from(value:hlist::ty![T0,T1,T2,T3,T4,T5]) -> Self {
441        let hlist::pat![t0,t1,t2,t3,t4,t5] = value;
442        (t0,t1,t2,t3,t4,t5)
443    }
444}
445
446impl<T0,T1,T2,T3,T4,T5,T6> From<hlist::ty![T0,T1,T2,T3,T4,T5,T6]>
447for (T0,T1,T2,T3,T4,T5,T6) {
448    #[inline(always)]
449    fn from(value:hlist::ty![T0,T1,T2,T3,T4,T5,T6]) -> Self {
450        let hlist::pat![t0,t1,t2,t3,t4,t5,t6] = value;
451        (t0,t1,t2,t3,t4,t5,t6)
452    }
453}
454
455impl<T0,T1,T2,T3,T4,T5,T6,T7> From<hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7]>
456for (T0,T1,T2,T3,T4,T5,T6,T7) {
457    #[inline(always)]
458    fn from(value:hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7]) -> Self {
459        let hlist::pat![t0,t1,t2,t3,t4,t5,t6,t7] = value;
460        (t0,t1,t2,t3,t4,t5,t6,t7)
461    }
462}
463
464impl<T0,T1,T2,T3,T4,T5,T6,T7,T8> From<hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7,T8]>
465for (T0,T1,T2,T3,T4,T5,T6,T7,T8) {
466    #[inline(always)]
467    fn from(value:hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7,T8]) -> Self {
468        let hlist::pat![t0,t1,t2,t3,t4,t5,t6,t7,t8] = value;
469        (t0,t1,t2,t3,t4,t5,t6,t7,t8)
470    }
471}
472
473impl<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> From<hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7,T8,T9]>
474for (T0,T1,T2,T3,T4,T5,T6,T7,T8,T9) {
475    #[inline(always)]
476    fn from(value:hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7,T8,T9]) -> Self {
477        let hlist::pat![t0,t1,t2,t3,t4,t5,t6,t7,t8,t9] = value;
478        (t0,t1,t2,t3,t4,t5,t6,t7,t8,t9)
479    }
480}
481
482impl<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> From<hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10]>
483for (T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10) {
484    #[inline(always)]
485    fn from(value:hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10]) -> Self {
486        let hlist::pat![t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10] = value;
487        (t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10)
488    }
489}
490
491impl<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> From<hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11]>
492for (T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11) {
493    #[inline(always)]
494    fn from(value:hlist::ty![T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11]) -> Self {
495        let hlist::pat![t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] = value;
496        (t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11)
497    }
498}
499
500
501
502// ==============================
503// === HasTupleRepr for HList ===
504// ==============================
505
506impl HasTupleRepr
507for hlist::ty![] {
508    type TupleRepr = ();
509}
510
511impl<T1> HasTupleRepr
512for hlist::ty![T1] {
513    type TupleRepr = (T1,);
514}
515
516impl<T1,T2> HasTupleRepr
517for hlist::ty![T1,T2] {
518    type TupleRepr = (T1,T2);
519}
520
521impl<T1,T2,T3> HasTupleRepr
522for hlist::ty![T1,T2,T3] {
523    type TupleRepr = (T1,T2,T3);
524}
525
526impl<T1,T2,T3,T4> HasTupleRepr
527for hlist::ty![T1,T2,T3,T4] {
528    type TupleRepr = (T1,T2,T3,T4);
529}
530
531impl<T1,T2,T3,T4,T5> HasTupleRepr
532for hlist::ty![T1,T2,T3,T4,T5] {
533    type TupleRepr = (T1,T2,T3,T4,T5);
534}
535
536impl<T1,T2,T3,T4,T5,T6> HasTupleRepr
537for hlist::ty![T1,T2,T3,T4,T5,T6] {
538    type TupleRepr = (T1,T2,T3,T4,T5,T6);
539}
540
541impl<T1,T2,T3,T4,T5,T6,T7> HasTupleRepr
542for hlist::ty![T1,T2,T3,T4,T5,T6,T7] {
543    type TupleRepr = (T1,T2,T3,T4,T5,T6,T7);
544}
545
546impl<T1,T2,T3,T4,T5,T6,T7,T8> HasTupleRepr
547for hlist::ty![T1,T2,T3,T4,T5,T6,T7,T8] {
548    type TupleRepr = (T1,T2,T3,T4,T5,T6,T7,T8);
549}
550
551impl<T1,T2,T3,T4,T5,T6,T7,T8,T9> HasTupleRepr
552for hlist::ty![T1,T2,T3,T4,T5,T6,T7,T8,T9] {
553    type TupleRepr = (T1,T2,T3,T4,T5,T6,T7,T8,T9);
554}
555
556impl<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> HasTupleRepr
557for hlist::ty![T1,T2,T3,T4,T5,T6,T7,T8,T9,T10] {
558    type TupleRepr = (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10);
559}
560
561impl<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> HasTupleRepr
562for hlist::ty![T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11] {
563    type TupleRepr = (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11);
564}
565
566
567
568// =================
569// === HasItemAt ===
570// =================
571
572macro_rules! gen_has_item_at {
573    ($at:ident $p:tt) => {};
574    ($at:ident [$($p:ident),*] $t:ident $(,$($ts:ident),*)?) => {
575        impl<$($p,)* X $(,$($ts),*)?> $crate::HasItemAt<$at> for ($($p,)*X,$($($ts,)*)?) {
576            type Item = X;
577        }
578        gen_has_item_at! { $at [$($p),*] $($($ts),*)? }
579    }
580}
581
582gen_has_item_at!{U0  [] T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11}
583gen_has_item_at!{U1  [T0] T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11}
584gen_has_item_at!{U2  [T0,T1] T2,T3,T4,T5,T6,T7,T8,T9,T10,T11}
585gen_has_item_at!{U3  [T0,T1,T2] T3,T4,T5,T6,T7,T8,T9,T10,T11}
586gen_has_item_at!{U4  [T0,T1,T2,T3] T4,T5,T6,T7,T8,T9,T10,T11}
587gen_has_item_at!{U5  [T0,T1,T2,T3,T4] T5,T6,T7,T8,T9,T10,T11}
588gen_has_item_at!{U6  [T0,T1,T2,T3,T4,T5] T6,T7,T8,T9,T10,T11}
589gen_has_item_at!{U7  [T0,T1,T2,T3,T4,T5,T6] T7,T8,T9,T10,T11}
590gen_has_item_at!{U8  [T0,T1,T2,T3,T4,T5,T6,T7] T8,T9,T10,T11}
591gen_has_item_at!{U9  [T0,T1,T2,T3,T4,T5,T6,T7,T8] T9,T10,T11}
592gen_has_item_at!{U10 [T0,T1,T2,T3,T4,T5,T6,T7,T8,T9] T10,T11}
593gen_has_item_at!{U11 [T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10] T11}
594
595
596
597// =================
598// === GetItemAt ===
599// =================
600
601macro_rules! gen_get_item_at {
602    ($at:ident $num:tt $p:tt) => {};
603    ($at:ident $num:tt [$($p:ident),*] $t:ident $(,$($ts:ident),*)?) => {
604        impl<$($p,)* X $(,$($ts),*)?> $crate::GetItemAt<$at> for ($($p,)*X,$($($ts,)*)?) {
605            fn get_item_at(&self) -> &X { &self.$num }
606        }
607        gen_get_item_at! { $at $num [$($p),*] $($($ts),*)? }
608    }
609}
610
611gen_get_item_at!{U0  0  [] T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11}
612gen_get_item_at!{U1  1  [T0] T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11}
613gen_get_item_at!{U2  2  [T0,T1] T2,T3,T4,T5,T6,T7,T8,T9,T10,T11}
614gen_get_item_at!{U3  3  [T0,T1,T2] T3,T4,T5,T6,T7,T8,T9,T10,T11}
615gen_get_item_at!{U4  4  [T0,T1,T2,T3] T4,T5,T6,T7,T8,T9,T10,T11}
616gen_get_item_at!{U5  5  [T0,T1,T2,T3,T4] T5,T6,T7,T8,T9,T10,T11}
617gen_get_item_at!{U6  6  [T0,T1,T2,T3,T4,T5] T6,T7,T8,T9,T10,T11}
618gen_get_item_at!{U7  7  [T0,T1,T2,T3,T4,T5,T6] T7,T8,T9,T10,T11}
619gen_get_item_at!{U8  8  [T0,T1,T2,T3,T4,T5,T6,T7] T8,T9,T10,T11}
620gen_get_item_at!{U9  9  [T0,T1,T2,T3,T4,T5,T6,T7,T8] T9,T10,T11}
621gen_get_item_at!{U10 10 [T0,T1,T2,T3,T4,T5,T6,T7,T8,T9] T10,T11}
622gen_get_item_at!{U11 11 [T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10] T11}