tupletools/ops/
div.rs

1use core::ops::Div;
2
3pub trait Division {
4    type Output;
5    fn div(self, other: Self) -> Self::Output;
6}
7
8impl<T1: Div<Output = T1>> Division for (T1,) {
9    type Output = (T1,);
10    fn div(self, other: Self) -> Self::Output {
11        (self.0 / other.0,)
12    }
13}
14
15impl<T1: Div<Output = T1>, T2: Div<Output = T2>> Division for (T1, T2) {
16    type Output = (T1, T2);
17    fn div(self, other: Self) -> Self::Output {
18        (self.0 / other.0, self.1 / other.1)
19    }
20}
21
22impl<T1: Div<Output = T1>, T2: Div<Output = T2>, T3: Div<Output = T3>> Division for (T1, T2, T3) {
23    type Output = (T1, T2, T3);
24    fn div(self, other: Self) -> Self::Output {
25        (self.0 / other.0, self.1 / other.1, self.2 / other.2)
26    }
27}
28
29impl<T1: Div<Output = T1>, T2: Div<Output = T2>, T3: Div<Output = T3>, T4: Div<Output = T4>>
30    Division for (T1, T2, T3, T4)
31{
32    type Output = (T1, T2, T3, T4);
33    fn div(self, other: Self) -> Self::Output {
34        (
35            self.0 / other.0,
36            self.1 / other.1,
37            self.2 / other.2,
38            self.3 / other.3,
39        )
40    }
41}
42
43impl<
44        T1: Div<Output = T1>,
45        T2: Div<Output = T2>,
46        T3: Div<Output = T3>,
47        T4: Div<Output = T4>,
48        T5: Div<Output = T5>,
49    > Division for (T1, T2, T3, T4, T5)
50{
51    type Output = (T1, T2, T3, T4, T5);
52    fn div(self, other: Self) -> Self::Output {
53        (
54            self.0 / other.0,
55            self.1 / other.1,
56            self.2 / other.2,
57            self.3 / other.3,
58            self.4 / other.4,
59        )
60    }
61}
62
63impl<
64        T1: Div<Output = T1>,
65        T2: Div<Output = T2>,
66        T3: Div<Output = T3>,
67        T4: Div<Output = T4>,
68        T5: Div<Output = T5>,
69        T6: Div<Output = T6>,
70    > Division for (T1, T2, T3, T4, T5, T6)
71{
72    type Output = (T1, T2, T3, T4, T5, T6);
73    fn div(self, other: Self) -> Self::Output {
74        (
75            self.0 / other.0,
76            self.1 / other.1,
77            self.2 / other.2,
78            self.3 / other.3,
79            self.4 / other.4,
80            self.5 / other.5,
81        )
82    }
83}
84
85impl<
86        T1: Div<Output = T1>,
87        T2: Div<Output = T2>,
88        T3: Div<Output = T3>,
89        T4: Div<Output = T4>,
90        T5: Div<Output = T5>,
91        T6: Div<Output = T6>,
92        T7: Div<Output = T7>,
93    > Division for (T1, T2, T3, T4, T5, T6, T7)
94{
95    type Output = (T1, T2, T3, T4, T5, T6, T7);
96    fn div(self, other: Self) -> Self::Output {
97        (
98            self.0 / other.0,
99            self.1 / other.1,
100            self.2 / other.2,
101            self.3 / other.3,
102            self.4 / other.4,
103            self.5 / other.5,
104            self.6 / other.6,
105        )
106    }
107}
108
109impl<
110        T1: Div<Output = T1>,
111        T2: Div<Output = T2>,
112        T3: Div<Output = T3>,
113        T4: Div<Output = T4>,
114        T5: Div<Output = T5>,
115        T6: Div<Output = T6>,
116        T7: Div<Output = T7>,
117        T8: Div<Output = T8>,
118    > Division for (T1, T2, T3, T4, T5, T6, T7, T8)
119{
120    type Output = (T1, T2, T3, T4, T5, T6, T7, T8);
121    fn div(self, other: Self) -> Self::Output {
122        (
123            self.0 / other.0,
124            self.1 / other.1,
125            self.2 / other.2,
126            self.3 / other.3,
127            self.4 / other.4,
128            self.5 / other.5,
129            self.6 / other.6,
130            self.7 / other.7,
131        )
132    }
133}
134
135impl<
136        T1: Div<Output = T1>,
137        T2: Div<Output = T2>,
138        T3: Div<Output = T3>,
139        T4: Div<Output = T4>,
140        T5: Div<Output = T5>,
141        T6: Div<Output = T6>,
142        T7: Div<Output = T7>,
143        T8: Div<Output = T8>,
144        T9: Div<Output = T9>,
145    > Division for (T1, T2, T3, T4, T5, T6, T7, T8, T9)
146{
147    type Output = (T1, T2, T3, T4, T5, T6, T7, T8, T9);
148    fn div(self, other: Self) -> Self::Output {
149        (
150            self.0 / other.0,
151            self.1 / other.1,
152            self.2 / other.2,
153            self.3 / other.3,
154            self.4 / other.4,
155            self.5 / other.5,
156            self.6 / other.6,
157            self.7 / other.7,
158            self.8 / other.8,
159        )
160    }
161}
162
163impl<
164        T1: Div<Output = T1>,
165        T2: Div<Output = T2>,
166        T3: Div<Output = T3>,
167        T4: Div<Output = T4>,
168        T5: Div<Output = T5>,
169        T6: Div<Output = T6>,
170        T7: Div<Output = T7>,
171        T8: Div<Output = T8>,
172        T9: Div<Output = T9>,
173        T10: Div<Output = T10>,
174    > Division for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
175{
176    type Output = (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10);
177    fn div(self, other: Self) -> Self::Output {
178        (
179            self.0 / other.0,
180            self.1 / other.1,
181            self.2 / other.2,
182            self.3 / other.3,
183            self.4 / other.4,
184            self.5 / other.5,
185            self.6 / other.6,
186            self.7 / other.7,
187            self.8 / other.8,
188            self.9 / other.9,
189        )
190    }
191}
192
193impl<
194        T1: Div<Output = T1>,
195        T2: Div<Output = T2>,
196        T3: Div<Output = T3>,
197        T4: Div<Output = T4>,
198        T5: Div<Output = T5>,
199        T6: Div<Output = T6>,
200        T7: Div<Output = T7>,
201        T8: Div<Output = T8>,
202        T9: Div<Output = T9>,
203        T10: Div<Output = T10>,
204        T11: Div<Output = T11>,
205    > Division for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
206{
207    type Output = (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11);
208    fn div(self, other: Self) -> Self::Output {
209        (
210            self.0 / other.0,
211            self.1 / other.1,
212            self.2 / other.2,
213            self.3 / other.3,
214            self.4 / other.4,
215            self.5 / other.5,
216            self.6 / other.6,
217            self.7 / other.7,
218            self.8 / other.8,
219            self.9 / other.9,
220            self.10 / other.10,
221        )
222    }
223}
224
225impl<
226        T1: Div<Output = T1>,
227        T2: Div<Output = T2>,
228        T3: Div<Output = T3>,
229        T4: Div<Output = T4>,
230        T5: Div<Output = T5>,
231        T6: Div<Output = T6>,
232        T7: Div<Output = T7>,
233        T8: Div<Output = T8>,
234        T9: Div<Output = T9>,
235        T10: Div<Output = T10>,
236        T11: Div<Output = T11>,
237        T12: Div<Output = T12>,
238    > Division for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)
239{
240    type Output = (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12);
241    fn div(self, other: Self) -> Self::Output {
242        (
243            self.0 / other.0,
244            self.1 / other.1,
245            self.2 / other.2,
246            self.3 / other.3,
247            self.4 / other.4,
248            self.5 / other.5,
249            self.6 / other.6,
250            self.7 / other.7,
251            self.8 / other.8,
252            self.9 / other.9,
253            self.10 / other.10,
254            self.11 / other.11,
255        )
256    }
257}
258
259impl<
260        T1: Div<Output = T1>,
261        T2: Div<Output = T2>,
262        T3: Div<Output = T3>,
263        T4: Div<Output = T4>,
264        T5: Div<Output = T5>,
265        T6: Div<Output = T6>,
266        T7: Div<Output = T7>,
267        T8: Div<Output = T8>,
268        T9: Div<Output = T9>,
269        T10: Div<Output = T10>,
270        T11: Div<Output = T11>,
271        T12: Div<Output = T12>,
272        T13: Div<Output = T13>,
273    > Division for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)
274{
275    type Output = (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13);
276    fn div(self, other: Self) -> Self::Output {
277        (
278            self.0 / other.0,
279            self.1 / other.1,
280            self.2 / other.2,
281            self.3 / other.3,
282            self.4 / other.4,
283            self.5 / other.5,
284            self.6 / other.6,
285            self.7 / other.7,
286            self.8 / other.8,
287            self.9 / other.9,
288            self.10 / other.10,
289            self.11 / other.11,
290            self.12 / other.12,
291        )
292    }
293}
294
295impl<
296        T1: Div<Output = T1>,
297        T2: Div<Output = T2>,
298        T3: Div<Output = T3>,
299        T4: Div<Output = T4>,
300        T5: Div<Output = T5>,
301        T6: Div<Output = T6>,
302        T7: Div<Output = T7>,
303        T8: Div<Output = T8>,
304        T9: Div<Output = T9>,
305        T10: Div<Output = T10>,
306        T11: Div<Output = T11>,
307        T12: Div<Output = T12>,
308        T13: Div<Output = T13>,
309        T14: Div<Output = T14>,
310    > Division for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)
311{
312    type Output = (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14);
313    fn div(self, other: Self) -> Self::Output {
314        (
315            self.0 / other.0,
316            self.1 / other.1,
317            self.2 / other.2,
318            self.3 / other.3,
319            self.4 / other.4,
320            self.5 / other.5,
321            self.6 / other.6,
322            self.7 / other.7,
323            self.8 / other.8,
324            self.9 / other.9,
325            self.10 / other.10,
326            self.11 / other.11,
327            self.12 / other.12,
328            self.13 / other.13,
329        )
330    }
331}
332
333impl<
334        T1: Div<Output = T1>,
335        T2: Div<Output = T2>,
336        T3: Div<Output = T3>,
337        T4: Div<Output = T4>,
338        T5: Div<Output = T5>,
339        T6: Div<Output = T6>,
340        T7: Div<Output = T7>,
341        T8: Div<Output = T8>,
342        T9: Div<Output = T9>,
343        T10: Div<Output = T10>,
344        T11: Div<Output = T11>,
345        T12: Div<Output = T12>,
346        T13: Div<Output = T13>,
347        T14: Div<Output = T14>,
348        T15: Div<Output = T15>,
349    > Division
350    for (
351        T1,
352        T2,
353        T3,
354        T4,
355        T5,
356        T6,
357        T7,
358        T8,
359        T9,
360        T10,
361        T11,
362        T12,
363        T13,
364        T14,
365        T15,
366    )
367{
368    type Output = (
369        T1,
370        T2,
371        T3,
372        T4,
373        T5,
374        T6,
375        T7,
376        T8,
377        T9,
378        T10,
379        T11,
380        T12,
381        T13,
382        T14,
383        T15,
384    );
385    fn div(self, other: Self) -> Self::Output {
386        (
387            self.0 / other.0,
388            self.1 / other.1,
389            self.2 / other.2,
390            self.3 / other.3,
391            self.4 / other.4,
392            self.5 / other.5,
393            self.6 / other.6,
394            self.7 / other.7,
395            self.8 / other.8,
396            self.9 / other.9,
397            self.10 / other.10,
398            self.11 / other.11,
399            self.12 / other.12,
400            self.13 / other.13,
401            self.14 / other.14,
402        )
403    }
404}
405
406impl<
407        T1: Div<Output = T1>,
408        T2: Div<Output = T2>,
409        T3: Div<Output = T3>,
410        T4: Div<Output = T4>,
411        T5: Div<Output = T5>,
412        T6: Div<Output = T6>,
413        T7: Div<Output = T7>,
414        T8: Div<Output = T8>,
415        T9: Div<Output = T9>,
416        T10: Div<Output = T10>,
417        T11: Div<Output = T11>,
418        T12: Div<Output = T12>,
419        T13: Div<Output = T13>,
420        T14: Div<Output = T14>,
421        T15: Div<Output = T15>,
422        T16: Div<Output = T16>,
423    > Division
424    for (
425        T1,
426        T2,
427        T3,
428        T4,
429        T5,
430        T6,
431        T7,
432        T8,
433        T9,
434        T10,
435        T11,
436        T12,
437        T13,
438        T14,
439        T15,
440        T16,
441    )
442{
443    type Output = (
444        T1,
445        T2,
446        T3,
447        T4,
448        T5,
449        T6,
450        T7,
451        T8,
452        T9,
453        T10,
454        T11,
455        T12,
456        T13,
457        T14,
458        T15,
459        T16,
460    );
461    fn div(self, other: Self) -> Self::Output {
462        (
463            self.0 / other.0,
464            self.1 / other.1,
465            self.2 / other.2,
466            self.3 / other.3,
467            self.4 / other.4,
468            self.5 / other.5,
469            self.6 / other.6,
470            self.7 / other.7,
471            self.8 / other.8,
472            self.9 / other.9,
473            self.10 / other.10,
474            self.11 / other.11,
475            self.12 / other.12,
476            self.13 / other.13,
477            self.14 / other.14,
478            self.15 / other.15,
479        )
480    }
481}