re_query/clamped_zip/
generated.rs

1// This file was generated using `cargo r -p re_query --all-features --bin clamped_zip`.
2// DO NOT EDIT.
3
4// ---
5
6#![expect(clippy::too_many_arguments)]
7#![expect(clippy::type_complexity)]
8
9/// Returns a new [`ClampedZip1x1`] iterator.
10///
11/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
12/// shortest of its required iterators (`r0`).
13///
14/// Optional iterators (`o0`) will repeat their latest values if they happen to be too short
15/// to be zipped with the shortest of the required iterators.
16///
17/// If an optional iterator is not only too short but actually empty, its associated default function
18/// (`o0_default_fn`) will be executed and the resulting value repeated as necessary.
19pub fn clamped_zip_1x1<R0, O0, D0>(
20    r0: R0,
21    o0: O0,
22    o0_default_fn: D0,
23) -> ClampedZip1x1<R0::IntoIter, O0::IntoIter, D0>
24where
25    R0: IntoIterator,
26    O0: IntoIterator,
27    O0::Item: Clone,
28    D0: Fn() -> O0::Item,
29{
30    ClampedZip1x1 {
31        r0: r0.into_iter(),
32        o0: o0.into_iter(),
33        o0_default_fn,
34        o0_latest_value: None,
35    }
36}
37
38/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
39/// iterators.
40///
41/// See [`clamped_zip_1x1`] for more information.
42pub struct ClampedZip1x1<R0, O0, D0>
43where
44    R0: Iterator,
45    O0: Iterator,
46    O0::Item: Clone,
47    D0: Fn() -> O0::Item,
48{
49    r0: R0,
50    o0: O0,
51    o0_default_fn: D0,
52
53    o0_latest_value: Option<O0::Item>,
54}
55
56impl<R0, O0, D0> Iterator for ClampedZip1x1<R0, O0, D0>
57where
58    R0: Iterator,
59    O0: Iterator,
60    O0::Item: Clone,
61    D0: Fn() -> O0::Item,
62{
63    type Item = (R0::Item, O0::Item);
64
65    #[inline]
66    fn next(&mut self) -> Option<Self::Item> {
67        let r0_next = self.r0.next()?;
68        let o0_next = self.o0.next().or(self.o0_latest_value.take());
69
70        self.o0_latest_value.clone_from(&o0_next);
71
72        Some((r0_next, o0_next.unwrap_or_else(|| (self.o0_default_fn)())))
73    }
74}
75
76/// Returns a new [`ClampedZip1x2`] iterator.
77///
78/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
79/// shortest of its required iterators (`r0`).
80///
81/// Optional iterators (`o0`, `o1`) will repeat their latest values if they happen to be too short
82/// to be zipped with the shortest of the required iterators.
83///
84/// If an optional iterator is not only too short but actually empty, its associated default function
85/// (`o0_default_fn`, `o1_default_fn`) will be executed and the resulting value repeated as necessary.
86pub fn clamped_zip_1x2<R0, O0, O1, D0, D1>(
87    r0: R0,
88    o0: O0,
89    o0_default_fn: D0,
90    o1: O1,
91    o1_default_fn: D1,
92) -> ClampedZip1x2<R0::IntoIter, O0::IntoIter, O1::IntoIter, D0, D1>
93where
94    R0: IntoIterator,
95    O0: IntoIterator,
96    O0::Item: Clone,
97    O1: IntoIterator,
98    O1::Item: Clone,
99    D0: Fn() -> O0::Item,
100    D1: Fn() -> O1::Item,
101{
102    ClampedZip1x2 {
103        r0: r0.into_iter(),
104        o0: o0.into_iter(),
105        o1: o1.into_iter(),
106        o0_default_fn,
107        o1_default_fn,
108        o0_latest_value: None,
109        o1_latest_value: None,
110    }
111}
112
113/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
114/// iterators.
115///
116/// See [`clamped_zip_1x2`] for more information.
117pub struct ClampedZip1x2<R0, O0, O1, D0, D1>
118where
119    R0: Iterator,
120    O0: Iterator,
121    O0::Item: Clone,
122    O1: Iterator,
123    O1::Item: Clone,
124    D0: Fn() -> O0::Item,
125    D1: Fn() -> O1::Item,
126{
127    r0: R0,
128    o0: O0,
129    o1: O1,
130    o0_default_fn: D0,
131    o1_default_fn: D1,
132
133    o0_latest_value: Option<O0::Item>,
134    o1_latest_value: Option<O1::Item>,
135}
136
137impl<R0, O0, O1, D0, D1> Iterator for ClampedZip1x2<R0, O0, O1, D0, D1>
138where
139    R0: Iterator,
140    O0: Iterator,
141    O0::Item: Clone,
142    O1: Iterator,
143    O1::Item: Clone,
144    D0: Fn() -> O0::Item,
145    D1: Fn() -> O1::Item,
146{
147    type Item = (R0::Item, O0::Item, O1::Item);
148
149    #[inline]
150    fn next(&mut self) -> Option<Self::Item> {
151        let r0_next = self.r0.next()?;
152        let o0_next = self.o0.next().or(self.o0_latest_value.take());
153        let o1_next = self.o1.next().or(self.o1_latest_value.take());
154
155        self.o0_latest_value.clone_from(&o0_next);
156        self.o1_latest_value.clone_from(&o1_next);
157
158        Some((
159            r0_next,
160            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
161            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
162        ))
163    }
164}
165
166/// Returns a new [`ClampedZip1x3`] iterator.
167///
168/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
169/// shortest of its required iterators (`r0`).
170///
171/// Optional iterators (`o0`, `o1`, `o2`) will repeat their latest values if they happen to be too short
172/// to be zipped with the shortest of the required iterators.
173///
174/// If an optional iterator is not only too short but actually empty, its associated default function
175/// (`o0_default_fn`, `o1_default_fn`, `o2_default_fn`) will be executed and the resulting value repeated as necessary.
176pub fn clamped_zip_1x3<R0, O0, O1, O2, D0, D1, D2>(
177    r0: R0,
178    o0: O0,
179    o0_default_fn: D0,
180    o1: O1,
181    o1_default_fn: D1,
182    o2: O2,
183    o2_default_fn: D2,
184) -> ClampedZip1x3<R0::IntoIter, O0::IntoIter, O1::IntoIter, O2::IntoIter, D0, D1, D2>
185where
186    R0: IntoIterator,
187    O0: IntoIterator,
188    O0::Item: Clone,
189    O1: IntoIterator,
190    O1::Item: Clone,
191    O2: IntoIterator,
192    O2::Item: Clone,
193    D0: Fn() -> O0::Item,
194    D1: Fn() -> O1::Item,
195    D2: Fn() -> O2::Item,
196{
197    ClampedZip1x3 {
198        r0: r0.into_iter(),
199        o0: o0.into_iter(),
200        o1: o1.into_iter(),
201        o2: o2.into_iter(),
202        o0_default_fn,
203        o1_default_fn,
204        o2_default_fn,
205        o0_latest_value: None,
206        o1_latest_value: None,
207        o2_latest_value: None,
208    }
209}
210
211/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
212/// iterators.
213///
214/// See [`clamped_zip_1x3`] for more information.
215pub struct ClampedZip1x3<R0, O0, O1, O2, D0, D1, D2>
216where
217    R0: Iterator,
218    O0: Iterator,
219    O0::Item: Clone,
220    O1: Iterator,
221    O1::Item: Clone,
222    O2: Iterator,
223    O2::Item: Clone,
224    D0: Fn() -> O0::Item,
225    D1: Fn() -> O1::Item,
226    D2: Fn() -> O2::Item,
227{
228    r0: R0,
229    o0: O0,
230    o1: O1,
231    o2: O2,
232    o0_default_fn: D0,
233    o1_default_fn: D1,
234    o2_default_fn: D2,
235
236    o0_latest_value: Option<O0::Item>,
237    o1_latest_value: Option<O1::Item>,
238    o2_latest_value: Option<O2::Item>,
239}
240
241impl<R0, O0, O1, O2, D0, D1, D2> Iterator for ClampedZip1x3<R0, O0, O1, O2, D0, D1, D2>
242where
243    R0: Iterator,
244    O0: Iterator,
245    O0::Item: Clone,
246    O1: Iterator,
247    O1::Item: Clone,
248    O2: Iterator,
249    O2::Item: Clone,
250    D0: Fn() -> O0::Item,
251    D1: Fn() -> O1::Item,
252    D2: Fn() -> O2::Item,
253{
254    type Item = (R0::Item, O0::Item, O1::Item, O2::Item);
255
256    #[inline]
257    fn next(&mut self) -> Option<Self::Item> {
258        let r0_next = self.r0.next()?;
259        let o0_next = self.o0.next().or(self.o0_latest_value.take());
260        let o1_next = self.o1.next().or(self.o1_latest_value.take());
261        let o2_next = self.o2.next().or(self.o2_latest_value.take());
262
263        self.o0_latest_value.clone_from(&o0_next);
264        self.o1_latest_value.clone_from(&o1_next);
265        self.o2_latest_value.clone_from(&o2_next);
266
267        Some((
268            r0_next,
269            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
270            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
271            o2_next.unwrap_or_else(|| (self.o2_default_fn)()),
272        ))
273    }
274}
275
276/// Returns a new [`ClampedZip1x4`] iterator.
277///
278/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
279/// shortest of its required iterators (`r0`).
280///
281/// Optional iterators (`o0`, `o1`, `o2`, `o3`) will repeat their latest values if they happen to be too short
282/// to be zipped with the shortest of the required iterators.
283///
284/// If an optional iterator is not only too short but actually empty, its associated default function
285/// (`o0_default_fn`, `o1_default_fn`, `o2_default_fn`, `o3_default_fn`) will be executed and the resulting value repeated as necessary.
286pub fn clamped_zip_1x4<R0, O0, O1, O2, O3, D0, D1, D2, D3>(
287    r0: R0,
288    o0: O0,
289    o0_default_fn: D0,
290    o1: O1,
291    o1_default_fn: D1,
292    o2: O2,
293    o2_default_fn: D2,
294    o3: O3,
295    o3_default_fn: D3,
296) -> ClampedZip1x4<
297    R0::IntoIter,
298    O0::IntoIter,
299    O1::IntoIter,
300    O2::IntoIter,
301    O3::IntoIter,
302    D0,
303    D1,
304    D2,
305    D3,
306>
307where
308    R0: IntoIterator,
309    O0: IntoIterator,
310    O0::Item: Clone,
311    O1: IntoIterator,
312    O1::Item: Clone,
313    O2: IntoIterator,
314    O2::Item: Clone,
315    O3: IntoIterator,
316    O3::Item: Clone,
317    D0: Fn() -> O0::Item,
318    D1: Fn() -> O1::Item,
319    D2: Fn() -> O2::Item,
320    D3: Fn() -> O3::Item,
321{
322    ClampedZip1x4 {
323        r0: r0.into_iter(),
324        o0: o0.into_iter(),
325        o1: o1.into_iter(),
326        o2: o2.into_iter(),
327        o3: o3.into_iter(),
328        o0_default_fn,
329        o1_default_fn,
330        o2_default_fn,
331        o3_default_fn,
332        o0_latest_value: None,
333        o1_latest_value: None,
334        o2_latest_value: None,
335        o3_latest_value: None,
336    }
337}
338
339/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
340/// iterators.
341///
342/// See [`clamped_zip_1x4`] for more information.
343pub struct ClampedZip1x4<R0, O0, O1, O2, O3, D0, D1, D2, D3>
344where
345    R0: Iterator,
346    O0: Iterator,
347    O0::Item: Clone,
348    O1: Iterator,
349    O1::Item: Clone,
350    O2: Iterator,
351    O2::Item: Clone,
352    O3: Iterator,
353    O3::Item: Clone,
354    D0: Fn() -> O0::Item,
355    D1: Fn() -> O1::Item,
356    D2: Fn() -> O2::Item,
357    D3: Fn() -> O3::Item,
358{
359    r0: R0,
360    o0: O0,
361    o1: O1,
362    o2: O2,
363    o3: O3,
364    o0_default_fn: D0,
365    o1_default_fn: D1,
366    o2_default_fn: D2,
367    o3_default_fn: D3,
368
369    o0_latest_value: Option<O0::Item>,
370    o1_latest_value: Option<O1::Item>,
371    o2_latest_value: Option<O2::Item>,
372    o3_latest_value: Option<O3::Item>,
373}
374
375impl<R0, O0, O1, O2, O3, D0, D1, D2, D3> Iterator
376    for ClampedZip1x4<R0, O0, O1, O2, O3, D0, D1, D2, D3>
377where
378    R0: Iterator,
379    O0: Iterator,
380    O0::Item: Clone,
381    O1: Iterator,
382    O1::Item: Clone,
383    O2: Iterator,
384    O2::Item: Clone,
385    O3: Iterator,
386    O3::Item: Clone,
387    D0: Fn() -> O0::Item,
388    D1: Fn() -> O1::Item,
389    D2: Fn() -> O2::Item,
390    D3: Fn() -> O3::Item,
391{
392    type Item = (R0::Item, O0::Item, O1::Item, O2::Item, O3::Item);
393
394    #[inline]
395    fn next(&mut self) -> Option<Self::Item> {
396        let r0_next = self.r0.next()?;
397        let o0_next = self.o0.next().or(self.o0_latest_value.take());
398        let o1_next = self.o1.next().or(self.o1_latest_value.take());
399        let o2_next = self.o2.next().or(self.o2_latest_value.take());
400        let o3_next = self.o3.next().or(self.o3_latest_value.take());
401
402        self.o0_latest_value.clone_from(&o0_next);
403        self.o1_latest_value.clone_from(&o1_next);
404        self.o2_latest_value.clone_from(&o2_next);
405        self.o3_latest_value.clone_from(&o3_next);
406
407        Some((
408            r0_next,
409            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
410            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
411            o2_next.unwrap_or_else(|| (self.o2_default_fn)()),
412            o3_next.unwrap_or_else(|| (self.o3_default_fn)()),
413        ))
414    }
415}
416
417/// Returns a new [`ClampedZip1x5`] iterator.
418///
419/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
420/// shortest of its required iterators (`r0`).
421///
422/// Optional iterators (`o0`, `o1`, `o2`, `o3`, `o4`) will repeat their latest values if they happen to be too short
423/// to be zipped with the shortest of the required iterators.
424///
425/// If an optional iterator is not only too short but actually empty, its associated default function
426/// (`o0_default_fn`, `o1_default_fn`, `o2_default_fn`, `o3_default_fn`, `o4_default_fn`) will be executed and the resulting value repeated as necessary.
427pub fn clamped_zip_1x5<R0, O0, O1, O2, O3, O4, D0, D1, D2, D3, D4>(
428    r0: R0,
429    o0: O0,
430    o0_default_fn: D0,
431    o1: O1,
432    o1_default_fn: D1,
433    o2: O2,
434    o2_default_fn: D2,
435    o3: O3,
436    o3_default_fn: D3,
437    o4: O4,
438    o4_default_fn: D4,
439) -> ClampedZip1x5<
440    R0::IntoIter,
441    O0::IntoIter,
442    O1::IntoIter,
443    O2::IntoIter,
444    O3::IntoIter,
445    O4::IntoIter,
446    D0,
447    D1,
448    D2,
449    D3,
450    D4,
451>
452where
453    R0: IntoIterator,
454    O0: IntoIterator,
455    O0::Item: Clone,
456    O1: IntoIterator,
457    O1::Item: Clone,
458    O2: IntoIterator,
459    O2::Item: Clone,
460    O3: IntoIterator,
461    O3::Item: Clone,
462    O4: IntoIterator,
463    O4::Item: Clone,
464    D0: Fn() -> O0::Item,
465    D1: Fn() -> O1::Item,
466    D2: Fn() -> O2::Item,
467    D3: Fn() -> O3::Item,
468    D4: Fn() -> O4::Item,
469{
470    ClampedZip1x5 {
471        r0: r0.into_iter(),
472        o0: o0.into_iter(),
473        o1: o1.into_iter(),
474        o2: o2.into_iter(),
475        o3: o3.into_iter(),
476        o4: o4.into_iter(),
477        o0_default_fn,
478        o1_default_fn,
479        o2_default_fn,
480        o3_default_fn,
481        o4_default_fn,
482        o0_latest_value: None,
483        o1_latest_value: None,
484        o2_latest_value: None,
485        o3_latest_value: None,
486        o4_latest_value: None,
487    }
488}
489
490/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
491/// iterators.
492///
493/// See [`clamped_zip_1x5`] for more information.
494pub struct ClampedZip1x5<R0, O0, O1, O2, O3, O4, D0, D1, D2, D3, D4>
495where
496    R0: Iterator,
497    O0: Iterator,
498    O0::Item: Clone,
499    O1: Iterator,
500    O1::Item: Clone,
501    O2: Iterator,
502    O2::Item: Clone,
503    O3: Iterator,
504    O3::Item: Clone,
505    O4: Iterator,
506    O4::Item: Clone,
507    D0: Fn() -> O0::Item,
508    D1: Fn() -> O1::Item,
509    D2: Fn() -> O2::Item,
510    D3: Fn() -> O3::Item,
511    D4: Fn() -> O4::Item,
512{
513    r0: R0,
514    o0: O0,
515    o1: O1,
516    o2: O2,
517    o3: O3,
518    o4: O4,
519    o0_default_fn: D0,
520    o1_default_fn: D1,
521    o2_default_fn: D2,
522    o3_default_fn: D3,
523    o4_default_fn: D4,
524
525    o0_latest_value: Option<O0::Item>,
526    o1_latest_value: Option<O1::Item>,
527    o2_latest_value: Option<O2::Item>,
528    o3_latest_value: Option<O3::Item>,
529    o4_latest_value: Option<O4::Item>,
530}
531
532impl<R0, O0, O1, O2, O3, O4, D0, D1, D2, D3, D4> Iterator
533    for ClampedZip1x5<R0, O0, O1, O2, O3, O4, D0, D1, D2, D3, D4>
534where
535    R0: Iterator,
536    O0: Iterator,
537    O0::Item: Clone,
538    O1: Iterator,
539    O1::Item: Clone,
540    O2: Iterator,
541    O2::Item: Clone,
542    O3: Iterator,
543    O3::Item: Clone,
544    O4: Iterator,
545    O4::Item: Clone,
546    D0: Fn() -> O0::Item,
547    D1: Fn() -> O1::Item,
548    D2: Fn() -> O2::Item,
549    D3: Fn() -> O3::Item,
550    D4: Fn() -> O4::Item,
551{
552    type Item = (R0::Item, O0::Item, O1::Item, O2::Item, O3::Item, O4::Item);
553
554    #[inline]
555    fn next(&mut self) -> Option<Self::Item> {
556        let r0_next = self.r0.next()?;
557        let o0_next = self.o0.next().or(self.o0_latest_value.take());
558        let o1_next = self.o1.next().or(self.o1_latest_value.take());
559        let o2_next = self.o2.next().or(self.o2_latest_value.take());
560        let o3_next = self.o3.next().or(self.o3_latest_value.take());
561        let o4_next = self.o4.next().or(self.o4_latest_value.take());
562
563        self.o0_latest_value.clone_from(&o0_next);
564        self.o1_latest_value.clone_from(&o1_next);
565        self.o2_latest_value.clone_from(&o2_next);
566        self.o3_latest_value.clone_from(&o3_next);
567        self.o4_latest_value.clone_from(&o4_next);
568
569        Some((
570            r0_next,
571            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
572            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
573            o2_next.unwrap_or_else(|| (self.o2_default_fn)()),
574            o3_next.unwrap_or_else(|| (self.o3_default_fn)()),
575            o4_next.unwrap_or_else(|| (self.o4_default_fn)()),
576        ))
577    }
578}
579
580/// Returns a new [`ClampedZip1x6`] iterator.
581///
582/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
583/// shortest of its required iterators (`r0`).
584///
585/// Optional iterators (`o0`, `o1`, `o2`, `o3`, `o4`, `o5`) will repeat their latest values if they happen to be too short
586/// to be zipped with the shortest of the required iterators.
587///
588/// If an optional iterator is not only too short but actually empty, its associated default function
589/// (`o0_default_fn`, `o1_default_fn`, `o2_default_fn`, `o3_default_fn`, `o4_default_fn`, `o5_default_fn`) will be executed and the resulting value repeated as necessary.
590pub fn clamped_zip_1x6<R0, O0, O1, O2, O3, O4, O5, D0, D1, D2, D3, D4, D5>(
591    r0: R0,
592    o0: O0,
593    o0_default_fn: D0,
594    o1: O1,
595    o1_default_fn: D1,
596    o2: O2,
597    o2_default_fn: D2,
598    o3: O3,
599    o3_default_fn: D3,
600    o4: O4,
601    o4_default_fn: D4,
602    o5: O5,
603    o5_default_fn: D5,
604) -> ClampedZip1x6<
605    R0::IntoIter,
606    O0::IntoIter,
607    O1::IntoIter,
608    O2::IntoIter,
609    O3::IntoIter,
610    O4::IntoIter,
611    O5::IntoIter,
612    D0,
613    D1,
614    D2,
615    D3,
616    D4,
617    D5,
618>
619where
620    R0: IntoIterator,
621    O0: IntoIterator,
622    O0::Item: Clone,
623    O1: IntoIterator,
624    O1::Item: Clone,
625    O2: IntoIterator,
626    O2::Item: Clone,
627    O3: IntoIterator,
628    O3::Item: Clone,
629    O4: IntoIterator,
630    O4::Item: Clone,
631    O5: IntoIterator,
632    O5::Item: Clone,
633    D0: Fn() -> O0::Item,
634    D1: Fn() -> O1::Item,
635    D2: Fn() -> O2::Item,
636    D3: Fn() -> O3::Item,
637    D4: Fn() -> O4::Item,
638    D5: Fn() -> O5::Item,
639{
640    ClampedZip1x6 {
641        r0: r0.into_iter(),
642        o0: o0.into_iter(),
643        o1: o1.into_iter(),
644        o2: o2.into_iter(),
645        o3: o3.into_iter(),
646        o4: o4.into_iter(),
647        o5: o5.into_iter(),
648        o0_default_fn,
649        o1_default_fn,
650        o2_default_fn,
651        o3_default_fn,
652        o4_default_fn,
653        o5_default_fn,
654        o0_latest_value: None,
655        o1_latest_value: None,
656        o2_latest_value: None,
657        o3_latest_value: None,
658        o4_latest_value: None,
659        o5_latest_value: None,
660    }
661}
662
663/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
664/// iterators.
665///
666/// See [`clamped_zip_1x6`] for more information.
667pub struct ClampedZip1x6<R0, O0, O1, O2, O3, O4, O5, D0, D1, D2, D3, D4, D5>
668where
669    R0: Iterator,
670    O0: Iterator,
671    O0::Item: Clone,
672    O1: Iterator,
673    O1::Item: Clone,
674    O2: Iterator,
675    O2::Item: Clone,
676    O3: Iterator,
677    O3::Item: Clone,
678    O4: Iterator,
679    O4::Item: Clone,
680    O5: Iterator,
681    O5::Item: Clone,
682    D0: Fn() -> O0::Item,
683    D1: Fn() -> O1::Item,
684    D2: Fn() -> O2::Item,
685    D3: Fn() -> O3::Item,
686    D4: Fn() -> O4::Item,
687    D5: Fn() -> O5::Item,
688{
689    r0: R0,
690    o0: O0,
691    o1: O1,
692    o2: O2,
693    o3: O3,
694    o4: O4,
695    o5: O5,
696    o0_default_fn: D0,
697    o1_default_fn: D1,
698    o2_default_fn: D2,
699    o3_default_fn: D3,
700    o4_default_fn: D4,
701    o5_default_fn: D5,
702
703    o0_latest_value: Option<O0::Item>,
704    o1_latest_value: Option<O1::Item>,
705    o2_latest_value: Option<O2::Item>,
706    o3_latest_value: Option<O3::Item>,
707    o4_latest_value: Option<O4::Item>,
708    o5_latest_value: Option<O5::Item>,
709}
710
711impl<R0, O0, O1, O2, O3, O4, O5, D0, D1, D2, D3, D4, D5> Iterator
712    for ClampedZip1x6<R0, O0, O1, O2, O3, O4, O5, D0, D1, D2, D3, D4, D5>
713where
714    R0: Iterator,
715    O0: Iterator,
716    O0::Item: Clone,
717    O1: Iterator,
718    O1::Item: Clone,
719    O2: Iterator,
720    O2::Item: Clone,
721    O3: Iterator,
722    O3::Item: Clone,
723    O4: Iterator,
724    O4::Item: Clone,
725    O5: Iterator,
726    O5::Item: Clone,
727    D0: Fn() -> O0::Item,
728    D1: Fn() -> O1::Item,
729    D2: Fn() -> O2::Item,
730    D3: Fn() -> O3::Item,
731    D4: Fn() -> O4::Item,
732    D5: Fn() -> O5::Item,
733{
734    type Item = (
735        R0::Item,
736        O0::Item,
737        O1::Item,
738        O2::Item,
739        O3::Item,
740        O4::Item,
741        O5::Item,
742    );
743
744    #[inline]
745    fn next(&mut self) -> Option<Self::Item> {
746        let r0_next = self.r0.next()?;
747        let o0_next = self.o0.next().or(self.o0_latest_value.take());
748        let o1_next = self.o1.next().or(self.o1_latest_value.take());
749        let o2_next = self.o2.next().or(self.o2_latest_value.take());
750        let o3_next = self.o3.next().or(self.o3_latest_value.take());
751        let o4_next = self.o4.next().or(self.o4_latest_value.take());
752        let o5_next = self.o5.next().or(self.o5_latest_value.take());
753
754        self.o0_latest_value.clone_from(&o0_next);
755        self.o1_latest_value.clone_from(&o1_next);
756        self.o2_latest_value.clone_from(&o2_next);
757        self.o3_latest_value.clone_from(&o3_next);
758        self.o4_latest_value.clone_from(&o4_next);
759        self.o5_latest_value.clone_from(&o5_next);
760
761        Some((
762            r0_next,
763            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
764            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
765            o2_next.unwrap_or_else(|| (self.o2_default_fn)()),
766            o3_next.unwrap_or_else(|| (self.o3_default_fn)()),
767            o4_next.unwrap_or_else(|| (self.o4_default_fn)()),
768            o5_next.unwrap_or_else(|| (self.o5_default_fn)()),
769        ))
770    }
771}
772
773/// Returns a new [`ClampedZip1x7`] iterator.
774///
775/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
776/// shortest of its required iterators (`r0`).
777///
778/// Optional iterators (`o0`, `o1`, `o2`, `o3`, `o4`, `o5`, `o6`) will repeat their latest values if they happen to be too short
779/// to be zipped with the shortest of the required iterators.
780///
781/// If an optional iterator is not only too short but actually empty, its associated default function
782/// (`o0_default_fn`, `o1_default_fn`, `o2_default_fn`, `o3_default_fn`, `o4_default_fn`, `o5_default_fn`, `o6_default_fn`) will be executed and the resulting value repeated as necessary.
783pub fn clamped_zip_1x7<R0, O0, O1, O2, O3, O4, O5, O6, D0, D1, D2, D3, D4, D5, D6>(
784    r0: R0,
785    o0: O0,
786    o0_default_fn: D0,
787    o1: O1,
788    o1_default_fn: D1,
789    o2: O2,
790    o2_default_fn: D2,
791    o3: O3,
792    o3_default_fn: D3,
793    o4: O4,
794    o4_default_fn: D4,
795    o5: O5,
796    o5_default_fn: D5,
797    o6: O6,
798    o6_default_fn: D6,
799) -> ClampedZip1x7<
800    R0::IntoIter,
801    O0::IntoIter,
802    O1::IntoIter,
803    O2::IntoIter,
804    O3::IntoIter,
805    O4::IntoIter,
806    O5::IntoIter,
807    O6::IntoIter,
808    D0,
809    D1,
810    D2,
811    D3,
812    D4,
813    D5,
814    D6,
815>
816where
817    R0: IntoIterator,
818    O0: IntoIterator,
819    O0::Item: Clone,
820    O1: IntoIterator,
821    O1::Item: Clone,
822    O2: IntoIterator,
823    O2::Item: Clone,
824    O3: IntoIterator,
825    O3::Item: Clone,
826    O4: IntoIterator,
827    O4::Item: Clone,
828    O5: IntoIterator,
829    O5::Item: Clone,
830    O6: IntoIterator,
831    O6::Item: Clone,
832    D0: Fn() -> O0::Item,
833    D1: Fn() -> O1::Item,
834    D2: Fn() -> O2::Item,
835    D3: Fn() -> O3::Item,
836    D4: Fn() -> O4::Item,
837    D5: Fn() -> O5::Item,
838    D6: Fn() -> O6::Item,
839{
840    ClampedZip1x7 {
841        r0: r0.into_iter(),
842        o0: o0.into_iter(),
843        o1: o1.into_iter(),
844        o2: o2.into_iter(),
845        o3: o3.into_iter(),
846        o4: o4.into_iter(),
847        o5: o5.into_iter(),
848        o6: o6.into_iter(),
849        o0_default_fn,
850        o1_default_fn,
851        o2_default_fn,
852        o3_default_fn,
853        o4_default_fn,
854        o5_default_fn,
855        o6_default_fn,
856        o0_latest_value: None,
857        o1_latest_value: None,
858        o2_latest_value: None,
859        o3_latest_value: None,
860        o4_latest_value: None,
861        o5_latest_value: None,
862        o6_latest_value: None,
863    }
864}
865
866/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
867/// iterators.
868///
869/// See [`clamped_zip_1x7`] for more information.
870pub struct ClampedZip1x7<R0, O0, O1, O2, O3, O4, O5, O6, D0, D1, D2, D3, D4, D5, D6>
871where
872    R0: Iterator,
873    O0: Iterator,
874    O0::Item: Clone,
875    O1: Iterator,
876    O1::Item: Clone,
877    O2: Iterator,
878    O2::Item: Clone,
879    O3: Iterator,
880    O3::Item: Clone,
881    O4: Iterator,
882    O4::Item: Clone,
883    O5: Iterator,
884    O5::Item: Clone,
885    O6: Iterator,
886    O6::Item: Clone,
887    D0: Fn() -> O0::Item,
888    D1: Fn() -> O1::Item,
889    D2: Fn() -> O2::Item,
890    D3: Fn() -> O3::Item,
891    D4: Fn() -> O4::Item,
892    D5: Fn() -> O5::Item,
893    D6: Fn() -> O6::Item,
894{
895    r0: R0,
896    o0: O0,
897    o1: O1,
898    o2: O2,
899    o3: O3,
900    o4: O4,
901    o5: O5,
902    o6: O6,
903    o0_default_fn: D0,
904    o1_default_fn: D1,
905    o2_default_fn: D2,
906    o3_default_fn: D3,
907    o4_default_fn: D4,
908    o5_default_fn: D5,
909    o6_default_fn: D6,
910
911    o0_latest_value: Option<O0::Item>,
912    o1_latest_value: Option<O1::Item>,
913    o2_latest_value: Option<O2::Item>,
914    o3_latest_value: Option<O3::Item>,
915    o4_latest_value: Option<O4::Item>,
916    o5_latest_value: Option<O5::Item>,
917    o6_latest_value: Option<O6::Item>,
918}
919
920impl<R0, O0, O1, O2, O3, O4, O5, O6, D0, D1, D2, D3, D4, D5, D6> Iterator
921    for ClampedZip1x7<R0, O0, O1, O2, O3, O4, O5, O6, D0, D1, D2, D3, D4, D5, D6>
922where
923    R0: Iterator,
924    O0: Iterator,
925    O0::Item: Clone,
926    O1: Iterator,
927    O1::Item: Clone,
928    O2: Iterator,
929    O2::Item: Clone,
930    O3: Iterator,
931    O3::Item: Clone,
932    O4: Iterator,
933    O4::Item: Clone,
934    O5: Iterator,
935    O5::Item: Clone,
936    O6: Iterator,
937    O6::Item: Clone,
938    D0: Fn() -> O0::Item,
939    D1: Fn() -> O1::Item,
940    D2: Fn() -> O2::Item,
941    D3: Fn() -> O3::Item,
942    D4: Fn() -> O4::Item,
943    D5: Fn() -> O5::Item,
944    D6: Fn() -> O6::Item,
945{
946    type Item = (
947        R0::Item,
948        O0::Item,
949        O1::Item,
950        O2::Item,
951        O3::Item,
952        O4::Item,
953        O5::Item,
954        O6::Item,
955    );
956
957    #[inline]
958    fn next(&mut self) -> Option<Self::Item> {
959        let r0_next = self.r0.next()?;
960        let o0_next = self.o0.next().or(self.o0_latest_value.take());
961        let o1_next = self.o1.next().or(self.o1_latest_value.take());
962        let o2_next = self.o2.next().or(self.o2_latest_value.take());
963        let o3_next = self.o3.next().or(self.o3_latest_value.take());
964        let o4_next = self.o4.next().or(self.o4_latest_value.take());
965        let o5_next = self.o5.next().or(self.o5_latest_value.take());
966        let o6_next = self.o6.next().or(self.o6_latest_value.take());
967
968        self.o0_latest_value.clone_from(&o0_next);
969        self.o1_latest_value.clone_from(&o1_next);
970        self.o2_latest_value.clone_from(&o2_next);
971        self.o3_latest_value.clone_from(&o3_next);
972        self.o4_latest_value.clone_from(&o4_next);
973        self.o5_latest_value.clone_from(&o5_next);
974        self.o6_latest_value.clone_from(&o6_next);
975
976        Some((
977            r0_next,
978            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
979            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
980            o2_next.unwrap_or_else(|| (self.o2_default_fn)()),
981            o3_next.unwrap_or_else(|| (self.o3_default_fn)()),
982            o4_next.unwrap_or_else(|| (self.o4_default_fn)()),
983            o5_next.unwrap_or_else(|| (self.o5_default_fn)()),
984            o6_next.unwrap_or_else(|| (self.o6_default_fn)()),
985        ))
986    }
987}
988
989/// Returns a new [`ClampedZip1x8`] iterator.
990///
991/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
992/// shortest of its required iterators (`r0`).
993///
994/// Optional iterators (`o0`, `o1`, `o2`, `o3`, `o4`, `o5`, `o6`, `o7`) will repeat their latest values if they happen to be too short
995/// to be zipped with the shortest of the required iterators.
996///
997/// If an optional iterator is not only too short but actually empty, its associated default function
998/// (`o0_default_fn`, `o1_default_fn`, `o2_default_fn`, `o3_default_fn`, `o4_default_fn`, `o5_default_fn`, `o6_default_fn`, `o7_default_fn`) will be executed and the resulting value repeated as necessary.
999pub fn clamped_zip_1x8<R0, O0, O1, O2, O3, O4, O5, O6, O7, D0, D1, D2, D3, D4, D5, D6, D7>(
1000    r0: R0,
1001    o0: O0,
1002    o0_default_fn: D0,
1003    o1: O1,
1004    o1_default_fn: D1,
1005    o2: O2,
1006    o2_default_fn: D2,
1007    o3: O3,
1008    o3_default_fn: D3,
1009    o4: O4,
1010    o4_default_fn: D4,
1011    o5: O5,
1012    o5_default_fn: D5,
1013    o6: O6,
1014    o6_default_fn: D6,
1015    o7: O7,
1016    o7_default_fn: D7,
1017) -> ClampedZip1x8<
1018    R0::IntoIter,
1019    O0::IntoIter,
1020    O1::IntoIter,
1021    O2::IntoIter,
1022    O3::IntoIter,
1023    O4::IntoIter,
1024    O5::IntoIter,
1025    O6::IntoIter,
1026    O7::IntoIter,
1027    D0,
1028    D1,
1029    D2,
1030    D3,
1031    D4,
1032    D5,
1033    D6,
1034    D7,
1035>
1036where
1037    R0: IntoIterator,
1038    O0: IntoIterator,
1039    O0::Item: Clone,
1040    O1: IntoIterator,
1041    O1::Item: Clone,
1042    O2: IntoIterator,
1043    O2::Item: Clone,
1044    O3: IntoIterator,
1045    O3::Item: Clone,
1046    O4: IntoIterator,
1047    O4::Item: Clone,
1048    O5: IntoIterator,
1049    O5::Item: Clone,
1050    O6: IntoIterator,
1051    O6::Item: Clone,
1052    O7: IntoIterator,
1053    O7::Item: Clone,
1054    D0: Fn() -> O0::Item,
1055    D1: Fn() -> O1::Item,
1056    D2: Fn() -> O2::Item,
1057    D3: Fn() -> O3::Item,
1058    D4: Fn() -> O4::Item,
1059    D5: Fn() -> O5::Item,
1060    D6: Fn() -> O6::Item,
1061    D7: Fn() -> O7::Item,
1062{
1063    ClampedZip1x8 {
1064        r0: r0.into_iter(),
1065        o0: o0.into_iter(),
1066        o1: o1.into_iter(),
1067        o2: o2.into_iter(),
1068        o3: o3.into_iter(),
1069        o4: o4.into_iter(),
1070        o5: o5.into_iter(),
1071        o6: o6.into_iter(),
1072        o7: o7.into_iter(),
1073        o0_default_fn,
1074        o1_default_fn,
1075        o2_default_fn,
1076        o3_default_fn,
1077        o4_default_fn,
1078        o5_default_fn,
1079        o6_default_fn,
1080        o7_default_fn,
1081        o0_latest_value: None,
1082        o1_latest_value: None,
1083        o2_latest_value: None,
1084        o3_latest_value: None,
1085        o4_latest_value: None,
1086        o5_latest_value: None,
1087        o6_latest_value: None,
1088        o7_latest_value: None,
1089    }
1090}
1091
1092/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
1093/// iterators.
1094///
1095/// See [`clamped_zip_1x8`] for more information.
1096pub struct ClampedZip1x8<R0, O0, O1, O2, O3, O4, O5, O6, O7, D0, D1, D2, D3, D4, D5, D6, D7>
1097where
1098    R0: Iterator,
1099    O0: Iterator,
1100    O0::Item: Clone,
1101    O1: Iterator,
1102    O1::Item: Clone,
1103    O2: Iterator,
1104    O2::Item: Clone,
1105    O3: Iterator,
1106    O3::Item: Clone,
1107    O4: Iterator,
1108    O4::Item: Clone,
1109    O5: Iterator,
1110    O5::Item: Clone,
1111    O6: Iterator,
1112    O6::Item: Clone,
1113    O7: Iterator,
1114    O7::Item: Clone,
1115    D0: Fn() -> O0::Item,
1116    D1: Fn() -> O1::Item,
1117    D2: Fn() -> O2::Item,
1118    D3: Fn() -> O3::Item,
1119    D4: Fn() -> O4::Item,
1120    D5: Fn() -> O5::Item,
1121    D6: Fn() -> O6::Item,
1122    D7: Fn() -> O7::Item,
1123{
1124    r0: R0,
1125    o0: O0,
1126    o1: O1,
1127    o2: O2,
1128    o3: O3,
1129    o4: O4,
1130    o5: O5,
1131    o6: O6,
1132    o7: O7,
1133    o0_default_fn: D0,
1134    o1_default_fn: D1,
1135    o2_default_fn: D2,
1136    o3_default_fn: D3,
1137    o4_default_fn: D4,
1138    o5_default_fn: D5,
1139    o6_default_fn: D6,
1140    o7_default_fn: D7,
1141
1142    o0_latest_value: Option<O0::Item>,
1143    o1_latest_value: Option<O1::Item>,
1144    o2_latest_value: Option<O2::Item>,
1145    o3_latest_value: Option<O3::Item>,
1146    o4_latest_value: Option<O4::Item>,
1147    o5_latest_value: Option<O5::Item>,
1148    o6_latest_value: Option<O6::Item>,
1149    o7_latest_value: Option<O7::Item>,
1150}
1151
1152impl<R0, O0, O1, O2, O3, O4, O5, O6, O7, D0, D1, D2, D3, D4, D5, D6, D7> Iterator
1153    for ClampedZip1x8<R0, O0, O1, O2, O3, O4, O5, O6, O7, D0, D1, D2, D3, D4, D5, D6, D7>
1154where
1155    R0: Iterator,
1156    O0: Iterator,
1157    O0::Item: Clone,
1158    O1: Iterator,
1159    O1::Item: Clone,
1160    O2: Iterator,
1161    O2::Item: Clone,
1162    O3: Iterator,
1163    O3::Item: Clone,
1164    O4: Iterator,
1165    O4::Item: Clone,
1166    O5: Iterator,
1167    O5::Item: Clone,
1168    O6: Iterator,
1169    O6::Item: Clone,
1170    O7: Iterator,
1171    O7::Item: Clone,
1172    D0: Fn() -> O0::Item,
1173    D1: Fn() -> O1::Item,
1174    D2: Fn() -> O2::Item,
1175    D3: Fn() -> O3::Item,
1176    D4: Fn() -> O4::Item,
1177    D5: Fn() -> O5::Item,
1178    D6: Fn() -> O6::Item,
1179    D7: Fn() -> O7::Item,
1180{
1181    type Item = (
1182        R0::Item,
1183        O0::Item,
1184        O1::Item,
1185        O2::Item,
1186        O3::Item,
1187        O4::Item,
1188        O5::Item,
1189        O6::Item,
1190        O7::Item,
1191    );
1192
1193    #[inline]
1194    fn next(&mut self) -> Option<Self::Item> {
1195        let r0_next = self.r0.next()?;
1196        let o0_next = self.o0.next().or(self.o0_latest_value.take());
1197        let o1_next = self.o1.next().or(self.o1_latest_value.take());
1198        let o2_next = self.o2.next().or(self.o2_latest_value.take());
1199        let o3_next = self.o3.next().or(self.o3_latest_value.take());
1200        let o4_next = self.o4.next().or(self.o4_latest_value.take());
1201        let o5_next = self.o5.next().or(self.o5_latest_value.take());
1202        let o6_next = self.o6.next().or(self.o6_latest_value.take());
1203        let o7_next = self.o7.next().or(self.o7_latest_value.take());
1204
1205        self.o0_latest_value.clone_from(&o0_next);
1206        self.o1_latest_value.clone_from(&o1_next);
1207        self.o2_latest_value.clone_from(&o2_next);
1208        self.o3_latest_value.clone_from(&o3_next);
1209        self.o4_latest_value.clone_from(&o4_next);
1210        self.o5_latest_value.clone_from(&o5_next);
1211        self.o6_latest_value.clone_from(&o6_next);
1212        self.o7_latest_value.clone_from(&o7_next);
1213
1214        Some((
1215            r0_next,
1216            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
1217            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
1218            o2_next.unwrap_or_else(|| (self.o2_default_fn)()),
1219            o3_next.unwrap_or_else(|| (self.o3_default_fn)()),
1220            o4_next.unwrap_or_else(|| (self.o4_default_fn)()),
1221            o5_next.unwrap_or_else(|| (self.o5_default_fn)()),
1222            o6_next.unwrap_or_else(|| (self.o6_default_fn)()),
1223            o7_next.unwrap_or_else(|| (self.o7_default_fn)()),
1224        ))
1225    }
1226}
1227
1228/// Returns a new [`ClampedZip1x9`] iterator.
1229///
1230/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
1231/// shortest of its required iterators (`r0`).
1232///
1233/// Optional iterators (`o0`, `o1`, `o2`, `o3`, `o4`, `o5`, `o6`, `o7`, `o8`) will repeat their latest values if they happen to be too short
1234/// to be zipped with the shortest of the required iterators.
1235///
1236/// If an optional iterator is not only too short but actually empty, its associated default function
1237/// (`o0_default_fn`, `o1_default_fn`, `o2_default_fn`, `o3_default_fn`, `o4_default_fn`, `o5_default_fn`, `o6_default_fn`, `o7_default_fn`, `o8_default_fn`) will be executed and the resulting value repeated as necessary.
1238pub fn clamped_zip_1x9<R0, O0, O1, O2, O3, O4, O5, O6, O7, O8, D0, D1, D2, D3, D4, D5, D6, D7, D8>(
1239    r0: R0,
1240    o0: O0,
1241    o0_default_fn: D0,
1242    o1: O1,
1243    o1_default_fn: D1,
1244    o2: O2,
1245    o2_default_fn: D2,
1246    o3: O3,
1247    o3_default_fn: D3,
1248    o4: O4,
1249    o4_default_fn: D4,
1250    o5: O5,
1251    o5_default_fn: D5,
1252    o6: O6,
1253    o6_default_fn: D6,
1254    o7: O7,
1255    o7_default_fn: D7,
1256    o8: O8,
1257    o8_default_fn: D8,
1258) -> ClampedZip1x9<
1259    R0::IntoIter,
1260    O0::IntoIter,
1261    O1::IntoIter,
1262    O2::IntoIter,
1263    O3::IntoIter,
1264    O4::IntoIter,
1265    O5::IntoIter,
1266    O6::IntoIter,
1267    O7::IntoIter,
1268    O8::IntoIter,
1269    D0,
1270    D1,
1271    D2,
1272    D3,
1273    D4,
1274    D5,
1275    D6,
1276    D7,
1277    D8,
1278>
1279where
1280    R0: IntoIterator,
1281    O0: IntoIterator,
1282    O0::Item: Clone,
1283    O1: IntoIterator,
1284    O1::Item: Clone,
1285    O2: IntoIterator,
1286    O2::Item: Clone,
1287    O3: IntoIterator,
1288    O3::Item: Clone,
1289    O4: IntoIterator,
1290    O4::Item: Clone,
1291    O5: IntoIterator,
1292    O5::Item: Clone,
1293    O6: IntoIterator,
1294    O6::Item: Clone,
1295    O7: IntoIterator,
1296    O7::Item: Clone,
1297    O8: IntoIterator,
1298    O8::Item: Clone,
1299    D0: Fn() -> O0::Item,
1300    D1: Fn() -> O1::Item,
1301    D2: Fn() -> O2::Item,
1302    D3: Fn() -> O3::Item,
1303    D4: Fn() -> O4::Item,
1304    D5: Fn() -> O5::Item,
1305    D6: Fn() -> O6::Item,
1306    D7: Fn() -> O7::Item,
1307    D8: Fn() -> O8::Item,
1308{
1309    ClampedZip1x9 {
1310        r0: r0.into_iter(),
1311        o0: o0.into_iter(),
1312        o1: o1.into_iter(),
1313        o2: o2.into_iter(),
1314        o3: o3.into_iter(),
1315        o4: o4.into_iter(),
1316        o5: o5.into_iter(),
1317        o6: o6.into_iter(),
1318        o7: o7.into_iter(),
1319        o8: o8.into_iter(),
1320        o0_default_fn,
1321        o1_default_fn,
1322        o2_default_fn,
1323        o3_default_fn,
1324        o4_default_fn,
1325        o5_default_fn,
1326        o6_default_fn,
1327        o7_default_fn,
1328        o8_default_fn,
1329        o0_latest_value: None,
1330        o1_latest_value: None,
1331        o2_latest_value: None,
1332        o3_latest_value: None,
1333        o4_latest_value: None,
1334        o5_latest_value: None,
1335        o6_latest_value: None,
1336        o7_latest_value: None,
1337        o8_latest_value: None,
1338    }
1339}
1340
1341/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
1342/// iterators.
1343///
1344/// See [`clamped_zip_1x9`] for more information.
1345pub struct ClampedZip1x9<R0, O0, O1, O2, O3, O4, O5, O6, O7, O8, D0, D1, D2, D3, D4, D5, D6, D7, D8>
1346where
1347    R0: Iterator,
1348    O0: Iterator,
1349    O0::Item: Clone,
1350    O1: Iterator,
1351    O1::Item: Clone,
1352    O2: Iterator,
1353    O2::Item: Clone,
1354    O3: Iterator,
1355    O3::Item: Clone,
1356    O4: Iterator,
1357    O4::Item: Clone,
1358    O5: Iterator,
1359    O5::Item: Clone,
1360    O6: Iterator,
1361    O6::Item: Clone,
1362    O7: Iterator,
1363    O7::Item: Clone,
1364    O8: Iterator,
1365    O8::Item: Clone,
1366    D0: Fn() -> O0::Item,
1367    D1: Fn() -> O1::Item,
1368    D2: Fn() -> O2::Item,
1369    D3: Fn() -> O3::Item,
1370    D4: Fn() -> O4::Item,
1371    D5: Fn() -> O5::Item,
1372    D6: Fn() -> O6::Item,
1373    D7: Fn() -> O7::Item,
1374    D8: Fn() -> O8::Item,
1375{
1376    r0: R0,
1377    o0: O0,
1378    o1: O1,
1379    o2: O2,
1380    o3: O3,
1381    o4: O4,
1382    o5: O5,
1383    o6: O6,
1384    o7: O7,
1385    o8: O8,
1386    o0_default_fn: D0,
1387    o1_default_fn: D1,
1388    o2_default_fn: D2,
1389    o3_default_fn: D3,
1390    o4_default_fn: D4,
1391    o5_default_fn: D5,
1392    o6_default_fn: D6,
1393    o7_default_fn: D7,
1394    o8_default_fn: D8,
1395
1396    o0_latest_value: Option<O0::Item>,
1397    o1_latest_value: Option<O1::Item>,
1398    o2_latest_value: Option<O2::Item>,
1399    o3_latest_value: Option<O3::Item>,
1400    o4_latest_value: Option<O4::Item>,
1401    o5_latest_value: Option<O5::Item>,
1402    o6_latest_value: Option<O6::Item>,
1403    o7_latest_value: Option<O7::Item>,
1404    o8_latest_value: Option<O8::Item>,
1405}
1406
1407impl<R0, O0, O1, O2, O3, O4, O5, O6, O7, O8, D0, D1, D2, D3, D4, D5, D6, D7, D8> Iterator
1408    for ClampedZip1x9<R0, O0, O1, O2, O3, O4, O5, O6, O7, O8, D0, D1, D2, D3, D4, D5, D6, D7, D8>
1409where
1410    R0: Iterator,
1411    O0: Iterator,
1412    O0::Item: Clone,
1413    O1: Iterator,
1414    O1::Item: Clone,
1415    O2: Iterator,
1416    O2::Item: Clone,
1417    O3: Iterator,
1418    O3::Item: Clone,
1419    O4: Iterator,
1420    O4::Item: Clone,
1421    O5: Iterator,
1422    O5::Item: Clone,
1423    O6: Iterator,
1424    O6::Item: Clone,
1425    O7: Iterator,
1426    O7::Item: Clone,
1427    O8: Iterator,
1428    O8::Item: Clone,
1429    D0: Fn() -> O0::Item,
1430    D1: Fn() -> O1::Item,
1431    D2: Fn() -> O2::Item,
1432    D3: Fn() -> O3::Item,
1433    D4: Fn() -> O4::Item,
1434    D5: Fn() -> O5::Item,
1435    D6: Fn() -> O6::Item,
1436    D7: Fn() -> O7::Item,
1437    D8: Fn() -> O8::Item,
1438{
1439    type Item = (
1440        R0::Item,
1441        O0::Item,
1442        O1::Item,
1443        O2::Item,
1444        O3::Item,
1445        O4::Item,
1446        O5::Item,
1447        O6::Item,
1448        O7::Item,
1449        O8::Item,
1450    );
1451
1452    #[inline]
1453    fn next(&mut self) -> Option<Self::Item> {
1454        let r0_next = self.r0.next()?;
1455        let o0_next = self.o0.next().or(self.o0_latest_value.take());
1456        let o1_next = self.o1.next().or(self.o1_latest_value.take());
1457        let o2_next = self.o2.next().or(self.o2_latest_value.take());
1458        let o3_next = self.o3.next().or(self.o3_latest_value.take());
1459        let o4_next = self.o4.next().or(self.o4_latest_value.take());
1460        let o5_next = self.o5.next().or(self.o5_latest_value.take());
1461        let o6_next = self.o6.next().or(self.o6_latest_value.take());
1462        let o7_next = self.o7.next().or(self.o7_latest_value.take());
1463        let o8_next = self.o8.next().or(self.o8_latest_value.take());
1464
1465        self.o0_latest_value.clone_from(&o0_next);
1466        self.o1_latest_value.clone_from(&o1_next);
1467        self.o2_latest_value.clone_from(&o2_next);
1468        self.o3_latest_value.clone_from(&o3_next);
1469        self.o4_latest_value.clone_from(&o4_next);
1470        self.o5_latest_value.clone_from(&o5_next);
1471        self.o6_latest_value.clone_from(&o6_next);
1472        self.o7_latest_value.clone_from(&o7_next);
1473        self.o8_latest_value.clone_from(&o8_next);
1474
1475        Some((
1476            r0_next,
1477            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
1478            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
1479            o2_next.unwrap_or_else(|| (self.o2_default_fn)()),
1480            o3_next.unwrap_or_else(|| (self.o3_default_fn)()),
1481            o4_next.unwrap_or_else(|| (self.o4_default_fn)()),
1482            o5_next.unwrap_or_else(|| (self.o5_default_fn)()),
1483            o6_next.unwrap_or_else(|| (self.o6_default_fn)()),
1484            o7_next.unwrap_or_else(|| (self.o7_default_fn)()),
1485            o8_next.unwrap_or_else(|| (self.o8_default_fn)()),
1486        ))
1487    }
1488}
1489
1490/// Returns a new [`ClampedZip2x1`] iterator.
1491///
1492/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
1493/// shortest of its required iterators (`r0`, `r1`).
1494///
1495/// Optional iterators (`o0`) will repeat their latest values if they happen to be too short
1496/// to be zipped with the shortest of the required iterators.
1497///
1498/// If an optional iterator is not only too short but actually empty, its associated default function
1499/// (`o0_default_fn`) will be executed and the resulting value repeated as necessary.
1500pub fn clamped_zip_2x1<R0, R1, O0, D0>(
1501    r0: R0,
1502    r1: R1,
1503    o0: O0,
1504    o0_default_fn: D0,
1505) -> ClampedZip2x1<R0::IntoIter, R1::IntoIter, O0::IntoIter, D0>
1506where
1507    R0: IntoIterator,
1508    R1: IntoIterator,
1509    O0: IntoIterator,
1510    O0::Item: Clone,
1511    D0: Fn() -> O0::Item,
1512{
1513    ClampedZip2x1 {
1514        r0: r0.into_iter(),
1515        r1: r1.into_iter(),
1516        o0: o0.into_iter(),
1517        o0_default_fn,
1518        o0_latest_value: None,
1519    }
1520}
1521
1522/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
1523/// iterators.
1524///
1525/// See [`clamped_zip_2x1`] for more information.
1526pub struct ClampedZip2x1<R0, R1, O0, D0>
1527where
1528    R0: Iterator,
1529    R1: Iterator,
1530    O0: Iterator,
1531    O0::Item: Clone,
1532    D0: Fn() -> O0::Item,
1533{
1534    r0: R0,
1535    r1: R1,
1536    o0: O0,
1537    o0_default_fn: D0,
1538
1539    o0_latest_value: Option<O0::Item>,
1540}
1541
1542impl<R0, R1, O0, D0> Iterator for ClampedZip2x1<R0, R1, O0, D0>
1543where
1544    R0: Iterator,
1545    R1: Iterator,
1546    O0: Iterator,
1547    O0::Item: Clone,
1548    D0: Fn() -> O0::Item,
1549{
1550    type Item = (R0::Item, R1::Item, O0::Item);
1551
1552    #[inline]
1553    fn next(&mut self) -> Option<Self::Item> {
1554        let r0_next = self.r0.next()?;
1555        let r1_next = self.r1.next()?;
1556        let o0_next = self.o0.next().or(self.o0_latest_value.take());
1557
1558        self.o0_latest_value.clone_from(&o0_next);
1559
1560        Some((
1561            r0_next,
1562            r1_next,
1563            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
1564        ))
1565    }
1566}
1567
1568/// Returns a new [`ClampedZip2x2`] iterator.
1569///
1570/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
1571/// shortest of its required iterators (`r0`, `r1`).
1572///
1573/// Optional iterators (`o0`, `o1`) will repeat their latest values if they happen to be too short
1574/// to be zipped with the shortest of the required iterators.
1575///
1576/// If an optional iterator is not only too short but actually empty, its associated default function
1577/// (`o0_default_fn`, `o1_default_fn`) will be executed and the resulting value repeated as necessary.
1578pub fn clamped_zip_2x2<R0, R1, O0, O1, D0, D1>(
1579    r0: R0,
1580    r1: R1,
1581    o0: O0,
1582    o0_default_fn: D0,
1583    o1: O1,
1584    o1_default_fn: D1,
1585) -> ClampedZip2x2<R0::IntoIter, R1::IntoIter, O0::IntoIter, O1::IntoIter, D0, D1>
1586where
1587    R0: IntoIterator,
1588    R1: IntoIterator,
1589    O0: IntoIterator,
1590    O0::Item: Clone,
1591    O1: IntoIterator,
1592    O1::Item: Clone,
1593    D0: Fn() -> O0::Item,
1594    D1: Fn() -> O1::Item,
1595{
1596    ClampedZip2x2 {
1597        r0: r0.into_iter(),
1598        r1: r1.into_iter(),
1599        o0: o0.into_iter(),
1600        o1: o1.into_iter(),
1601        o0_default_fn,
1602        o1_default_fn,
1603        o0_latest_value: None,
1604        o1_latest_value: None,
1605    }
1606}
1607
1608/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
1609/// iterators.
1610///
1611/// See [`clamped_zip_2x2`] for more information.
1612pub struct ClampedZip2x2<R0, R1, O0, O1, D0, D1>
1613where
1614    R0: Iterator,
1615    R1: Iterator,
1616    O0: Iterator,
1617    O0::Item: Clone,
1618    O1: Iterator,
1619    O1::Item: Clone,
1620    D0: Fn() -> O0::Item,
1621    D1: Fn() -> O1::Item,
1622{
1623    r0: R0,
1624    r1: R1,
1625    o0: O0,
1626    o1: O1,
1627    o0_default_fn: D0,
1628    o1_default_fn: D1,
1629
1630    o0_latest_value: Option<O0::Item>,
1631    o1_latest_value: Option<O1::Item>,
1632}
1633
1634impl<R0, R1, O0, O1, D0, D1> Iterator for ClampedZip2x2<R0, R1, O0, O1, D0, D1>
1635where
1636    R0: Iterator,
1637    R1: Iterator,
1638    O0: Iterator,
1639    O0::Item: Clone,
1640    O1: Iterator,
1641    O1::Item: Clone,
1642    D0: Fn() -> O0::Item,
1643    D1: Fn() -> O1::Item,
1644{
1645    type Item = (R0::Item, R1::Item, O0::Item, O1::Item);
1646
1647    #[inline]
1648    fn next(&mut self) -> Option<Self::Item> {
1649        let r0_next = self.r0.next()?;
1650        let r1_next = self.r1.next()?;
1651        let o0_next = self.o0.next().or(self.o0_latest_value.take());
1652        let o1_next = self.o1.next().or(self.o1_latest_value.take());
1653
1654        self.o0_latest_value.clone_from(&o0_next);
1655        self.o1_latest_value.clone_from(&o1_next);
1656
1657        Some((
1658            r0_next,
1659            r1_next,
1660            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
1661            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
1662        ))
1663    }
1664}
1665
1666/// Returns a new [`ClampedZip2x3`] iterator.
1667///
1668/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
1669/// shortest of its required iterators (`r0`, `r1`).
1670///
1671/// Optional iterators (`o0`, `o1`, `o2`) will repeat their latest values if they happen to be too short
1672/// to be zipped with the shortest of the required iterators.
1673///
1674/// If an optional iterator is not only too short but actually empty, its associated default function
1675/// (`o0_default_fn`, `o1_default_fn`, `o2_default_fn`) will be executed and the resulting value repeated as necessary.
1676pub fn clamped_zip_2x3<R0, R1, O0, O1, O2, D0, D1, D2>(
1677    r0: R0,
1678    r1: R1,
1679    o0: O0,
1680    o0_default_fn: D0,
1681    o1: O1,
1682    o1_default_fn: D1,
1683    o2: O2,
1684    o2_default_fn: D2,
1685) -> ClampedZip2x3<R0::IntoIter, R1::IntoIter, O0::IntoIter, O1::IntoIter, O2::IntoIter, D0, D1, D2>
1686where
1687    R0: IntoIterator,
1688    R1: IntoIterator,
1689    O0: IntoIterator,
1690    O0::Item: Clone,
1691    O1: IntoIterator,
1692    O1::Item: Clone,
1693    O2: IntoIterator,
1694    O2::Item: Clone,
1695    D0: Fn() -> O0::Item,
1696    D1: Fn() -> O1::Item,
1697    D2: Fn() -> O2::Item,
1698{
1699    ClampedZip2x3 {
1700        r0: r0.into_iter(),
1701        r1: r1.into_iter(),
1702        o0: o0.into_iter(),
1703        o1: o1.into_iter(),
1704        o2: o2.into_iter(),
1705        o0_default_fn,
1706        o1_default_fn,
1707        o2_default_fn,
1708        o0_latest_value: None,
1709        o1_latest_value: None,
1710        o2_latest_value: None,
1711    }
1712}
1713
1714/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
1715/// iterators.
1716///
1717/// See [`clamped_zip_2x3`] for more information.
1718pub struct ClampedZip2x3<R0, R1, O0, O1, O2, D0, D1, D2>
1719where
1720    R0: Iterator,
1721    R1: Iterator,
1722    O0: Iterator,
1723    O0::Item: Clone,
1724    O1: Iterator,
1725    O1::Item: Clone,
1726    O2: Iterator,
1727    O2::Item: Clone,
1728    D0: Fn() -> O0::Item,
1729    D1: Fn() -> O1::Item,
1730    D2: Fn() -> O2::Item,
1731{
1732    r0: R0,
1733    r1: R1,
1734    o0: O0,
1735    o1: O1,
1736    o2: O2,
1737    o0_default_fn: D0,
1738    o1_default_fn: D1,
1739    o2_default_fn: D2,
1740
1741    o0_latest_value: Option<O0::Item>,
1742    o1_latest_value: Option<O1::Item>,
1743    o2_latest_value: Option<O2::Item>,
1744}
1745
1746impl<R0, R1, O0, O1, O2, D0, D1, D2> Iterator for ClampedZip2x3<R0, R1, O0, O1, O2, D0, D1, D2>
1747where
1748    R0: Iterator,
1749    R1: Iterator,
1750    O0: Iterator,
1751    O0::Item: Clone,
1752    O1: Iterator,
1753    O1::Item: Clone,
1754    O2: Iterator,
1755    O2::Item: Clone,
1756    D0: Fn() -> O0::Item,
1757    D1: Fn() -> O1::Item,
1758    D2: Fn() -> O2::Item,
1759{
1760    type Item = (R0::Item, R1::Item, O0::Item, O1::Item, O2::Item);
1761
1762    #[inline]
1763    fn next(&mut self) -> Option<Self::Item> {
1764        let r0_next = self.r0.next()?;
1765        let r1_next = self.r1.next()?;
1766        let o0_next = self.o0.next().or(self.o0_latest_value.take());
1767        let o1_next = self.o1.next().or(self.o1_latest_value.take());
1768        let o2_next = self.o2.next().or(self.o2_latest_value.take());
1769
1770        self.o0_latest_value.clone_from(&o0_next);
1771        self.o1_latest_value.clone_from(&o1_next);
1772        self.o2_latest_value.clone_from(&o2_next);
1773
1774        Some((
1775            r0_next,
1776            r1_next,
1777            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
1778            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
1779            o2_next.unwrap_or_else(|| (self.o2_default_fn)()),
1780        ))
1781    }
1782}
1783
1784/// Returns a new [`ClampedZip2x4`] iterator.
1785///
1786/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
1787/// shortest of its required iterators (`r0`, `r1`).
1788///
1789/// Optional iterators (`o0`, `o1`, `o2`, `o3`) will repeat their latest values if they happen to be too short
1790/// to be zipped with the shortest of the required iterators.
1791///
1792/// If an optional iterator is not only too short but actually empty, its associated default function
1793/// (`o0_default_fn`, `o1_default_fn`, `o2_default_fn`, `o3_default_fn`) will be executed and the resulting value repeated as necessary.
1794pub fn clamped_zip_2x4<R0, R1, O0, O1, O2, O3, D0, D1, D2, D3>(
1795    r0: R0,
1796    r1: R1,
1797    o0: O0,
1798    o0_default_fn: D0,
1799    o1: O1,
1800    o1_default_fn: D1,
1801    o2: O2,
1802    o2_default_fn: D2,
1803    o3: O3,
1804    o3_default_fn: D3,
1805) -> ClampedZip2x4<
1806    R0::IntoIter,
1807    R1::IntoIter,
1808    O0::IntoIter,
1809    O1::IntoIter,
1810    O2::IntoIter,
1811    O3::IntoIter,
1812    D0,
1813    D1,
1814    D2,
1815    D3,
1816>
1817where
1818    R0: IntoIterator,
1819    R1: IntoIterator,
1820    O0: IntoIterator,
1821    O0::Item: Clone,
1822    O1: IntoIterator,
1823    O1::Item: Clone,
1824    O2: IntoIterator,
1825    O2::Item: Clone,
1826    O3: IntoIterator,
1827    O3::Item: Clone,
1828    D0: Fn() -> O0::Item,
1829    D1: Fn() -> O1::Item,
1830    D2: Fn() -> O2::Item,
1831    D3: Fn() -> O3::Item,
1832{
1833    ClampedZip2x4 {
1834        r0: r0.into_iter(),
1835        r1: r1.into_iter(),
1836        o0: o0.into_iter(),
1837        o1: o1.into_iter(),
1838        o2: o2.into_iter(),
1839        o3: o3.into_iter(),
1840        o0_default_fn,
1841        o1_default_fn,
1842        o2_default_fn,
1843        o3_default_fn,
1844        o0_latest_value: None,
1845        o1_latest_value: None,
1846        o2_latest_value: None,
1847        o3_latest_value: None,
1848    }
1849}
1850
1851/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
1852/// iterators.
1853///
1854/// See [`clamped_zip_2x4`] for more information.
1855pub struct ClampedZip2x4<R0, R1, O0, O1, O2, O3, D0, D1, D2, D3>
1856where
1857    R0: Iterator,
1858    R1: Iterator,
1859    O0: Iterator,
1860    O0::Item: Clone,
1861    O1: Iterator,
1862    O1::Item: Clone,
1863    O2: Iterator,
1864    O2::Item: Clone,
1865    O3: Iterator,
1866    O3::Item: Clone,
1867    D0: Fn() -> O0::Item,
1868    D1: Fn() -> O1::Item,
1869    D2: Fn() -> O2::Item,
1870    D3: Fn() -> O3::Item,
1871{
1872    r0: R0,
1873    r1: R1,
1874    o0: O0,
1875    o1: O1,
1876    o2: O2,
1877    o3: O3,
1878    o0_default_fn: D0,
1879    o1_default_fn: D1,
1880    o2_default_fn: D2,
1881    o3_default_fn: D3,
1882
1883    o0_latest_value: Option<O0::Item>,
1884    o1_latest_value: Option<O1::Item>,
1885    o2_latest_value: Option<O2::Item>,
1886    o3_latest_value: Option<O3::Item>,
1887}
1888
1889impl<R0, R1, O0, O1, O2, O3, D0, D1, D2, D3> Iterator
1890    for ClampedZip2x4<R0, R1, O0, O1, O2, O3, D0, D1, D2, D3>
1891where
1892    R0: Iterator,
1893    R1: Iterator,
1894    O0: Iterator,
1895    O0::Item: Clone,
1896    O1: Iterator,
1897    O1::Item: Clone,
1898    O2: Iterator,
1899    O2::Item: Clone,
1900    O3: Iterator,
1901    O3::Item: Clone,
1902    D0: Fn() -> O0::Item,
1903    D1: Fn() -> O1::Item,
1904    D2: Fn() -> O2::Item,
1905    D3: Fn() -> O3::Item,
1906{
1907    type Item = (R0::Item, R1::Item, O0::Item, O1::Item, O2::Item, O3::Item);
1908
1909    #[inline]
1910    fn next(&mut self) -> Option<Self::Item> {
1911        let r0_next = self.r0.next()?;
1912        let r1_next = self.r1.next()?;
1913        let o0_next = self.o0.next().or(self.o0_latest_value.take());
1914        let o1_next = self.o1.next().or(self.o1_latest_value.take());
1915        let o2_next = self.o2.next().or(self.o2_latest_value.take());
1916        let o3_next = self.o3.next().or(self.o3_latest_value.take());
1917
1918        self.o0_latest_value.clone_from(&o0_next);
1919        self.o1_latest_value.clone_from(&o1_next);
1920        self.o2_latest_value.clone_from(&o2_next);
1921        self.o3_latest_value.clone_from(&o3_next);
1922
1923        Some((
1924            r0_next,
1925            r1_next,
1926            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
1927            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
1928            o2_next.unwrap_or_else(|| (self.o2_default_fn)()),
1929            o3_next.unwrap_or_else(|| (self.o3_default_fn)()),
1930        ))
1931    }
1932}
1933
1934/// Returns a new [`ClampedZip2x5`] iterator.
1935///
1936/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
1937/// shortest of its required iterators (`r0`, `r1`).
1938///
1939/// Optional iterators (`o0`, `o1`, `o2`, `o3`, `o4`) will repeat their latest values if they happen to be too short
1940/// to be zipped with the shortest of the required iterators.
1941///
1942/// If an optional iterator is not only too short but actually empty, its associated default function
1943/// (`o0_default_fn`, `o1_default_fn`, `o2_default_fn`, `o3_default_fn`, `o4_default_fn`) will be executed and the resulting value repeated as necessary.
1944pub fn clamped_zip_2x5<R0, R1, O0, O1, O2, O3, O4, D0, D1, D2, D3, D4>(
1945    r0: R0,
1946    r1: R1,
1947    o0: O0,
1948    o0_default_fn: D0,
1949    o1: O1,
1950    o1_default_fn: D1,
1951    o2: O2,
1952    o2_default_fn: D2,
1953    o3: O3,
1954    o3_default_fn: D3,
1955    o4: O4,
1956    o4_default_fn: D4,
1957) -> ClampedZip2x5<
1958    R0::IntoIter,
1959    R1::IntoIter,
1960    O0::IntoIter,
1961    O1::IntoIter,
1962    O2::IntoIter,
1963    O3::IntoIter,
1964    O4::IntoIter,
1965    D0,
1966    D1,
1967    D2,
1968    D3,
1969    D4,
1970>
1971where
1972    R0: IntoIterator,
1973    R1: IntoIterator,
1974    O0: IntoIterator,
1975    O0::Item: Clone,
1976    O1: IntoIterator,
1977    O1::Item: Clone,
1978    O2: IntoIterator,
1979    O2::Item: Clone,
1980    O3: IntoIterator,
1981    O3::Item: Clone,
1982    O4: IntoIterator,
1983    O4::Item: Clone,
1984    D0: Fn() -> O0::Item,
1985    D1: Fn() -> O1::Item,
1986    D2: Fn() -> O2::Item,
1987    D3: Fn() -> O3::Item,
1988    D4: Fn() -> O4::Item,
1989{
1990    ClampedZip2x5 {
1991        r0: r0.into_iter(),
1992        r1: r1.into_iter(),
1993        o0: o0.into_iter(),
1994        o1: o1.into_iter(),
1995        o2: o2.into_iter(),
1996        o3: o3.into_iter(),
1997        o4: o4.into_iter(),
1998        o0_default_fn,
1999        o1_default_fn,
2000        o2_default_fn,
2001        o3_default_fn,
2002        o4_default_fn,
2003        o0_latest_value: None,
2004        o1_latest_value: None,
2005        o2_latest_value: None,
2006        o3_latest_value: None,
2007        o4_latest_value: None,
2008    }
2009}
2010
2011/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
2012/// iterators.
2013///
2014/// See [`clamped_zip_2x5`] for more information.
2015pub struct ClampedZip2x5<R0, R1, O0, O1, O2, O3, O4, D0, D1, D2, D3, D4>
2016where
2017    R0: Iterator,
2018    R1: Iterator,
2019    O0: Iterator,
2020    O0::Item: Clone,
2021    O1: Iterator,
2022    O1::Item: Clone,
2023    O2: Iterator,
2024    O2::Item: Clone,
2025    O3: Iterator,
2026    O3::Item: Clone,
2027    O4: Iterator,
2028    O4::Item: Clone,
2029    D0: Fn() -> O0::Item,
2030    D1: Fn() -> O1::Item,
2031    D2: Fn() -> O2::Item,
2032    D3: Fn() -> O3::Item,
2033    D4: Fn() -> O4::Item,
2034{
2035    r0: R0,
2036    r1: R1,
2037    o0: O0,
2038    o1: O1,
2039    o2: O2,
2040    o3: O3,
2041    o4: O4,
2042    o0_default_fn: D0,
2043    o1_default_fn: D1,
2044    o2_default_fn: D2,
2045    o3_default_fn: D3,
2046    o4_default_fn: D4,
2047
2048    o0_latest_value: Option<O0::Item>,
2049    o1_latest_value: Option<O1::Item>,
2050    o2_latest_value: Option<O2::Item>,
2051    o3_latest_value: Option<O3::Item>,
2052    o4_latest_value: Option<O4::Item>,
2053}
2054
2055impl<R0, R1, O0, O1, O2, O3, O4, D0, D1, D2, D3, D4> Iterator
2056    for ClampedZip2x5<R0, R1, O0, O1, O2, O3, O4, D0, D1, D2, D3, D4>
2057where
2058    R0: Iterator,
2059    R1: Iterator,
2060    O0: Iterator,
2061    O0::Item: Clone,
2062    O1: Iterator,
2063    O1::Item: Clone,
2064    O2: Iterator,
2065    O2::Item: Clone,
2066    O3: Iterator,
2067    O3::Item: Clone,
2068    O4: Iterator,
2069    O4::Item: Clone,
2070    D0: Fn() -> O0::Item,
2071    D1: Fn() -> O1::Item,
2072    D2: Fn() -> O2::Item,
2073    D3: Fn() -> O3::Item,
2074    D4: Fn() -> O4::Item,
2075{
2076    type Item = (
2077        R0::Item,
2078        R1::Item,
2079        O0::Item,
2080        O1::Item,
2081        O2::Item,
2082        O3::Item,
2083        O4::Item,
2084    );
2085
2086    #[inline]
2087    fn next(&mut self) -> Option<Self::Item> {
2088        let r0_next = self.r0.next()?;
2089        let r1_next = self.r1.next()?;
2090        let o0_next = self.o0.next().or(self.o0_latest_value.take());
2091        let o1_next = self.o1.next().or(self.o1_latest_value.take());
2092        let o2_next = self.o2.next().or(self.o2_latest_value.take());
2093        let o3_next = self.o3.next().or(self.o3_latest_value.take());
2094        let o4_next = self.o4.next().or(self.o4_latest_value.take());
2095
2096        self.o0_latest_value.clone_from(&o0_next);
2097        self.o1_latest_value.clone_from(&o1_next);
2098        self.o2_latest_value.clone_from(&o2_next);
2099        self.o3_latest_value.clone_from(&o3_next);
2100        self.o4_latest_value.clone_from(&o4_next);
2101
2102        Some((
2103            r0_next,
2104            r1_next,
2105            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
2106            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
2107            o2_next.unwrap_or_else(|| (self.o2_default_fn)()),
2108            o3_next.unwrap_or_else(|| (self.o3_default_fn)()),
2109            o4_next.unwrap_or_else(|| (self.o4_default_fn)()),
2110        ))
2111    }
2112}
2113
2114/// Returns a new [`ClampedZip2x6`] iterator.
2115///
2116/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
2117/// shortest of its required iterators (`r0`, `r1`).
2118///
2119/// Optional iterators (`o0`, `o1`, `o2`, `o3`, `o4`, `o5`) will repeat their latest values if they happen to be too short
2120/// to be zipped with the shortest of the required iterators.
2121///
2122/// If an optional iterator is not only too short but actually empty, its associated default function
2123/// (`o0_default_fn`, `o1_default_fn`, `o2_default_fn`, `o3_default_fn`, `o4_default_fn`, `o5_default_fn`) will be executed and the resulting value repeated as necessary.
2124pub fn clamped_zip_2x6<R0, R1, O0, O1, O2, O3, O4, O5, D0, D1, D2, D3, D4, D5>(
2125    r0: R0,
2126    r1: R1,
2127    o0: O0,
2128    o0_default_fn: D0,
2129    o1: O1,
2130    o1_default_fn: D1,
2131    o2: O2,
2132    o2_default_fn: D2,
2133    o3: O3,
2134    o3_default_fn: D3,
2135    o4: O4,
2136    o4_default_fn: D4,
2137    o5: O5,
2138    o5_default_fn: D5,
2139) -> ClampedZip2x6<
2140    R0::IntoIter,
2141    R1::IntoIter,
2142    O0::IntoIter,
2143    O1::IntoIter,
2144    O2::IntoIter,
2145    O3::IntoIter,
2146    O4::IntoIter,
2147    O5::IntoIter,
2148    D0,
2149    D1,
2150    D2,
2151    D3,
2152    D4,
2153    D5,
2154>
2155where
2156    R0: IntoIterator,
2157    R1: IntoIterator,
2158    O0: IntoIterator,
2159    O0::Item: Clone,
2160    O1: IntoIterator,
2161    O1::Item: Clone,
2162    O2: IntoIterator,
2163    O2::Item: Clone,
2164    O3: IntoIterator,
2165    O3::Item: Clone,
2166    O4: IntoIterator,
2167    O4::Item: Clone,
2168    O5: IntoIterator,
2169    O5::Item: Clone,
2170    D0: Fn() -> O0::Item,
2171    D1: Fn() -> O1::Item,
2172    D2: Fn() -> O2::Item,
2173    D3: Fn() -> O3::Item,
2174    D4: Fn() -> O4::Item,
2175    D5: Fn() -> O5::Item,
2176{
2177    ClampedZip2x6 {
2178        r0: r0.into_iter(),
2179        r1: r1.into_iter(),
2180        o0: o0.into_iter(),
2181        o1: o1.into_iter(),
2182        o2: o2.into_iter(),
2183        o3: o3.into_iter(),
2184        o4: o4.into_iter(),
2185        o5: o5.into_iter(),
2186        o0_default_fn,
2187        o1_default_fn,
2188        o2_default_fn,
2189        o3_default_fn,
2190        o4_default_fn,
2191        o5_default_fn,
2192        o0_latest_value: None,
2193        o1_latest_value: None,
2194        o2_latest_value: None,
2195        o3_latest_value: None,
2196        o4_latest_value: None,
2197        o5_latest_value: None,
2198    }
2199}
2200
2201/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
2202/// iterators.
2203///
2204/// See [`clamped_zip_2x6`] for more information.
2205pub struct ClampedZip2x6<R0, R1, O0, O1, O2, O3, O4, O5, D0, D1, D2, D3, D4, D5>
2206where
2207    R0: Iterator,
2208    R1: Iterator,
2209    O0: Iterator,
2210    O0::Item: Clone,
2211    O1: Iterator,
2212    O1::Item: Clone,
2213    O2: Iterator,
2214    O2::Item: Clone,
2215    O3: Iterator,
2216    O3::Item: Clone,
2217    O4: Iterator,
2218    O4::Item: Clone,
2219    O5: Iterator,
2220    O5::Item: Clone,
2221    D0: Fn() -> O0::Item,
2222    D1: Fn() -> O1::Item,
2223    D2: Fn() -> O2::Item,
2224    D3: Fn() -> O3::Item,
2225    D4: Fn() -> O4::Item,
2226    D5: Fn() -> O5::Item,
2227{
2228    r0: R0,
2229    r1: R1,
2230    o0: O0,
2231    o1: O1,
2232    o2: O2,
2233    o3: O3,
2234    o4: O4,
2235    o5: O5,
2236    o0_default_fn: D0,
2237    o1_default_fn: D1,
2238    o2_default_fn: D2,
2239    o3_default_fn: D3,
2240    o4_default_fn: D4,
2241    o5_default_fn: D5,
2242
2243    o0_latest_value: Option<O0::Item>,
2244    o1_latest_value: Option<O1::Item>,
2245    o2_latest_value: Option<O2::Item>,
2246    o3_latest_value: Option<O3::Item>,
2247    o4_latest_value: Option<O4::Item>,
2248    o5_latest_value: Option<O5::Item>,
2249}
2250
2251impl<R0, R1, O0, O1, O2, O3, O4, O5, D0, D1, D2, D3, D4, D5> Iterator
2252    for ClampedZip2x6<R0, R1, O0, O1, O2, O3, O4, O5, D0, D1, D2, D3, D4, D5>
2253where
2254    R0: Iterator,
2255    R1: Iterator,
2256    O0: Iterator,
2257    O0::Item: Clone,
2258    O1: Iterator,
2259    O1::Item: Clone,
2260    O2: Iterator,
2261    O2::Item: Clone,
2262    O3: Iterator,
2263    O3::Item: Clone,
2264    O4: Iterator,
2265    O4::Item: Clone,
2266    O5: Iterator,
2267    O5::Item: Clone,
2268    D0: Fn() -> O0::Item,
2269    D1: Fn() -> O1::Item,
2270    D2: Fn() -> O2::Item,
2271    D3: Fn() -> O3::Item,
2272    D4: Fn() -> O4::Item,
2273    D5: Fn() -> O5::Item,
2274{
2275    type Item = (
2276        R0::Item,
2277        R1::Item,
2278        O0::Item,
2279        O1::Item,
2280        O2::Item,
2281        O3::Item,
2282        O4::Item,
2283        O5::Item,
2284    );
2285
2286    #[inline]
2287    fn next(&mut self) -> Option<Self::Item> {
2288        let r0_next = self.r0.next()?;
2289        let r1_next = self.r1.next()?;
2290        let o0_next = self.o0.next().or(self.o0_latest_value.take());
2291        let o1_next = self.o1.next().or(self.o1_latest_value.take());
2292        let o2_next = self.o2.next().or(self.o2_latest_value.take());
2293        let o3_next = self.o3.next().or(self.o3_latest_value.take());
2294        let o4_next = self.o4.next().or(self.o4_latest_value.take());
2295        let o5_next = self.o5.next().or(self.o5_latest_value.take());
2296
2297        self.o0_latest_value.clone_from(&o0_next);
2298        self.o1_latest_value.clone_from(&o1_next);
2299        self.o2_latest_value.clone_from(&o2_next);
2300        self.o3_latest_value.clone_from(&o3_next);
2301        self.o4_latest_value.clone_from(&o4_next);
2302        self.o5_latest_value.clone_from(&o5_next);
2303
2304        Some((
2305            r0_next,
2306            r1_next,
2307            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
2308            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
2309            o2_next.unwrap_or_else(|| (self.o2_default_fn)()),
2310            o3_next.unwrap_or_else(|| (self.o3_default_fn)()),
2311            o4_next.unwrap_or_else(|| (self.o4_default_fn)()),
2312            o5_next.unwrap_or_else(|| (self.o5_default_fn)()),
2313        ))
2314    }
2315}
2316
2317/// Returns a new [`ClampedZip2x7`] iterator.
2318///
2319/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
2320/// shortest of its required iterators (`r0`, `r1`).
2321///
2322/// Optional iterators (`o0`, `o1`, `o2`, `o3`, `o4`, `o5`, `o6`) will repeat their latest values if they happen to be too short
2323/// to be zipped with the shortest of the required iterators.
2324///
2325/// If an optional iterator is not only too short but actually empty, its associated default function
2326/// (`o0_default_fn`, `o1_default_fn`, `o2_default_fn`, `o3_default_fn`, `o4_default_fn`, `o5_default_fn`, `o6_default_fn`) will be executed and the resulting value repeated as necessary.
2327pub fn clamped_zip_2x7<R0, R1, O0, O1, O2, O3, O4, O5, O6, D0, D1, D2, D3, D4, D5, D6>(
2328    r0: R0,
2329    r1: R1,
2330    o0: O0,
2331    o0_default_fn: D0,
2332    o1: O1,
2333    o1_default_fn: D1,
2334    o2: O2,
2335    o2_default_fn: D2,
2336    o3: O3,
2337    o3_default_fn: D3,
2338    o4: O4,
2339    o4_default_fn: D4,
2340    o5: O5,
2341    o5_default_fn: D5,
2342    o6: O6,
2343    o6_default_fn: D6,
2344) -> ClampedZip2x7<
2345    R0::IntoIter,
2346    R1::IntoIter,
2347    O0::IntoIter,
2348    O1::IntoIter,
2349    O2::IntoIter,
2350    O3::IntoIter,
2351    O4::IntoIter,
2352    O5::IntoIter,
2353    O6::IntoIter,
2354    D0,
2355    D1,
2356    D2,
2357    D3,
2358    D4,
2359    D5,
2360    D6,
2361>
2362where
2363    R0: IntoIterator,
2364    R1: IntoIterator,
2365    O0: IntoIterator,
2366    O0::Item: Clone,
2367    O1: IntoIterator,
2368    O1::Item: Clone,
2369    O2: IntoIterator,
2370    O2::Item: Clone,
2371    O3: IntoIterator,
2372    O3::Item: Clone,
2373    O4: IntoIterator,
2374    O4::Item: Clone,
2375    O5: IntoIterator,
2376    O5::Item: Clone,
2377    O6: IntoIterator,
2378    O6::Item: Clone,
2379    D0: Fn() -> O0::Item,
2380    D1: Fn() -> O1::Item,
2381    D2: Fn() -> O2::Item,
2382    D3: Fn() -> O3::Item,
2383    D4: Fn() -> O4::Item,
2384    D5: Fn() -> O5::Item,
2385    D6: Fn() -> O6::Item,
2386{
2387    ClampedZip2x7 {
2388        r0: r0.into_iter(),
2389        r1: r1.into_iter(),
2390        o0: o0.into_iter(),
2391        o1: o1.into_iter(),
2392        o2: o2.into_iter(),
2393        o3: o3.into_iter(),
2394        o4: o4.into_iter(),
2395        o5: o5.into_iter(),
2396        o6: o6.into_iter(),
2397        o0_default_fn,
2398        o1_default_fn,
2399        o2_default_fn,
2400        o3_default_fn,
2401        o4_default_fn,
2402        o5_default_fn,
2403        o6_default_fn,
2404        o0_latest_value: None,
2405        o1_latest_value: None,
2406        o2_latest_value: None,
2407        o3_latest_value: None,
2408        o4_latest_value: None,
2409        o5_latest_value: None,
2410        o6_latest_value: None,
2411    }
2412}
2413
2414/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
2415/// iterators.
2416///
2417/// See [`clamped_zip_2x7`] for more information.
2418pub struct ClampedZip2x7<R0, R1, O0, O1, O2, O3, O4, O5, O6, D0, D1, D2, D3, D4, D5, D6>
2419where
2420    R0: Iterator,
2421    R1: Iterator,
2422    O0: Iterator,
2423    O0::Item: Clone,
2424    O1: Iterator,
2425    O1::Item: Clone,
2426    O2: Iterator,
2427    O2::Item: Clone,
2428    O3: Iterator,
2429    O3::Item: Clone,
2430    O4: Iterator,
2431    O4::Item: Clone,
2432    O5: Iterator,
2433    O5::Item: Clone,
2434    O6: Iterator,
2435    O6::Item: Clone,
2436    D0: Fn() -> O0::Item,
2437    D1: Fn() -> O1::Item,
2438    D2: Fn() -> O2::Item,
2439    D3: Fn() -> O3::Item,
2440    D4: Fn() -> O4::Item,
2441    D5: Fn() -> O5::Item,
2442    D6: Fn() -> O6::Item,
2443{
2444    r0: R0,
2445    r1: R1,
2446    o0: O0,
2447    o1: O1,
2448    o2: O2,
2449    o3: O3,
2450    o4: O4,
2451    o5: O5,
2452    o6: O6,
2453    o0_default_fn: D0,
2454    o1_default_fn: D1,
2455    o2_default_fn: D2,
2456    o3_default_fn: D3,
2457    o4_default_fn: D4,
2458    o5_default_fn: D5,
2459    o6_default_fn: D6,
2460
2461    o0_latest_value: Option<O0::Item>,
2462    o1_latest_value: Option<O1::Item>,
2463    o2_latest_value: Option<O2::Item>,
2464    o3_latest_value: Option<O3::Item>,
2465    o4_latest_value: Option<O4::Item>,
2466    o5_latest_value: Option<O5::Item>,
2467    o6_latest_value: Option<O6::Item>,
2468}
2469
2470impl<R0, R1, O0, O1, O2, O3, O4, O5, O6, D0, D1, D2, D3, D4, D5, D6> Iterator
2471    for ClampedZip2x7<R0, R1, O0, O1, O2, O3, O4, O5, O6, D0, D1, D2, D3, D4, D5, D6>
2472where
2473    R0: Iterator,
2474    R1: Iterator,
2475    O0: Iterator,
2476    O0::Item: Clone,
2477    O1: Iterator,
2478    O1::Item: Clone,
2479    O2: Iterator,
2480    O2::Item: Clone,
2481    O3: Iterator,
2482    O3::Item: Clone,
2483    O4: Iterator,
2484    O4::Item: Clone,
2485    O5: Iterator,
2486    O5::Item: Clone,
2487    O6: Iterator,
2488    O6::Item: Clone,
2489    D0: Fn() -> O0::Item,
2490    D1: Fn() -> O1::Item,
2491    D2: Fn() -> O2::Item,
2492    D3: Fn() -> O3::Item,
2493    D4: Fn() -> O4::Item,
2494    D5: Fn() -> O5::Item,
2495    D6: Fn() -> O6::Item,
2496{
2497    type Item = (
2498        R0::Item,
2499        R1::Item,
2500        O0::Item,
2501        O1::Item,
2502        O2::Item,
2503        O3::Item,
2504        O4::Item,
2505        O5::Item,
2506        O6::Item,
2507    );
2508
2509    #[inline]
2510    fn next(&mut self) -> Option<Self::Item> {
2511        let r0_next = self.r0.next()?;
2512        let r1_next = self.r1.next()?;
2513        let o0_next = self.o0.next().or(self.o0_latest_value.take());
2514        let o1_next = self.o1.next().or(self.o1_latest_value.take());
2515        let o2_next = self.o2.next().or(self.o2_latest_value.take());
2516        let o3_next = self.o3.next().or(self.o3_latest_value.take());
2517        let o4_next = self.o4.next().or(self.o4_latest_value.take());
2518        let o5_next = self.o5.next().or(self.o5_latest_value.take());
2519        let o6_next = self.o6.next().or(self.o6_latest_value.take());
2520
2521        self.o0_latest_value.clone_from(&o0_next);
2522        self.o1_latest_value.clone_from(&o1_next);
2523        self.o2_latest_value.clone_from(&o2_next);
2524        self.o3_latest_value.clone_from(&o3_next);
2525        self.o4_latest_value.clone_from(&o4_next);
2526        self.o5_latest_value.clone_from(&o5_next);
2527        self.o6_latest_value.clone_from(&o6_next);
2528
2529        Some((
2530            r0_next,
2531            r1_next,
2532            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
2533            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
2534            o2_next.unwrap_or_else(|| (self.o2_default_fn)()),
2535            o3_next.unwrap_or_else(|| (self.o3_default_fn)()),
2536            o4_next.unwrap_or_else(|| (self.o4_default_fn)()),
2537            o5_next.unwrap_or_else(|| (self.o5_default_fn)()),
2538            o6_next.unwrap_or_else(|| (self.o6_default_fn)()),
2539        ))
2540    }
2541}
2542
2543/// Returns a new [`ClampedZip2x8`] iterator.
2544///
2545/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
2546/// shortest of its required iterators (`r0`, `r1`).
2547///
2548/// Optional iterators (`o0`, `o1`, `o2`, `o3`, `o4`, `o5`, `o6`, `o7`) will repeat their latest values if they happen to be too short
2549/// to be zipped with the shortest of the required iterators.
2550///
2551/// If an optional iterator is not only too short but actually empty, its associated default function
2552/// (`o0_default_fn`, `o1_default_fn`, `o2_default_fn`, `o3_default_fn`, `o4_default_fn`, `o5_default_fn`, `o6_default_fn`, `o7_default_fn`) will be executed and the resulting value repeated as necessary.
2553pub fn clamped_zip_2x8<R0, R1, O0, O1, O2, O3, O4, O5, O6, O7, D0, D1, D2, D3, D4, D5, D6, D7>(
2554    r0: R0,
2555    r1: R1,
2556    o0: O0,
2557    o0_default_fn: D0,
2558    o1: O1,
2559    o1_default_fn: D1,
2560    o2: O2,
2561    o2_default_fn: D2,
2562    o3: O3,
2563    o3_default_fn: D3,
2564    o4: O4,
2565    o4_default_fn: D4,
2566    o5: O5,
2567    o5_default_fn: D5,
2568    o6: O6,
2569    o6_default_fn: D6,
2570    o7: O7,
2571    o7_default_fn: D7,
2572) -> ClampedZip2x8<
2573    R0::IntoIter,
2574    R1::IntoIter,
2575    O0::IntoIter,
2576    O1::IntoIter,
2577    O2::IntoIter,
2578    O3::IntoIter,
2579    O4::IntoIter,
2580    O5::IntoIter,
2581    O6::IntoIter,
2582    O7::IntoIter,
2583    D0,
2584    D1,
2585    D2,
2586    D3,
2587    D4,
2588    D5,
2589    D6,
2590    D7,
2591>
2592where
2593    R0: IntoIterator,
2594    R1: IntoIterator,
2595    O0: IntoIterator,
2596    O0::Item: Clone,
2597    O1: IntoIterator,
2598    O1::Item: Clone,
2599    O2: IntoIterator,
2600    O2::Item: Clone,
2601    O3: IntoIterator,
2602    O3::Item: Clone,
2603    O4: IntoIterator,
2604    O4::Item: Clone,
2605    O5: IntoIterator,
2606    O5::Item: Clone,
2607    O6: IntoIterator,
2608    O6::Item: Clone,
2609    O7: IntoIterator,
2610    O7::Item: Clone,
2611    D0: Fn() -> O0::Item,
2612    D1: Fn() -> O1::Item,
2613    D2: Fn() -> O2::Item,
2614    D3: Fn() -> O3::Item,
2615    D4: Fn() -> O4::Item,
2616    D5: Fn() -> O5::Item,
2617    D6: Fn() -> O6::Item,
2618    D7: Fn() -> O7::Item,
2619{
2620    ClampedZip2x8 {
2621        r0: r0.into_iter(),
2622        r1: r1.into_iter(),
2623        o0: o0.into_iter(),
2624        o1: o1.into_iter(),
2625        o2: o2.into_iter(),
2626        o3: o3.into_iter(),
2627        o4: o4.into_iter(),
2628        o5: o5.into_iter(),
2629        o6: o6.into_iter(),
2630        o7: o7.into_iter(),
2631        o0_default_fn,
2632        o1_default_fn,
2633        o2_default_fn,
2634        o3_default_fn,
2635        o4_default_fn,
2636        o5_default_fn,
2637        o6_default_fn,
2638        o7_default_fn,
2639        o0_latest_value: None,
2640        o1_latest_value: None,
2641        o2_latest_value: None,
2642        o3_latest_value: None,
2643        o4_latest_value: None,
2644        o5_latest_value: None,
2645        o6_latest_value: None,
2646        o7_latest_value: None,
2647    }
2648}
2649
2650/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
2651/// iterators.
2652///
2653/// See [`clamped_zip_2x8`] for more information.
2654pub struct ClampedZip2x8<R0, R1, O0, O1, O2, O3, O4, O5, O6, O7, D0, D1, D2, D3, D4, D5, D6, D7>
2655where
2656    R0: Iterator,
2657    R1: Iterator,
2658    O0: Iterator,
2659    O0::Item: Clone,
2660    O1: Iterator,
2661    O1::Item: Clone,
2662    O2: Iterator,
2663    O2::Item: Clone,
2664    O3: Iterator,
2665    O3::Item: Clone,
2666    O4: Iterator,
2667    O4::Item: Clone,
2668    O5: Iterator,
2669    O5::Item: Clone,
2670    O6: Iterator,
2671    O6::Item: Clone,
2672    O7: Iterator,
2673    O7::Item: Clone,
2674    D0: Fn() -> O0::Item,
2675    D1: Fn() -> O1::Item,
2676    D2: Fn() -> O2::Item,
2677    D3: Fn() -> O3::Item,
2678    D4: Fn() -> O4::Item,
2679    D5: Fn() -> O5::Item,
2680    D6: Fn() -> O6::Item,
2681    D7: Fn() -> O7::Item,
2682{
2683    r0: R0,
2684    r1: R1,
2685    o0: O0,
2686    o1: O1,
2687    o2: O2,
2688    o3: O3,
2689    o4: O4,
2690    o5: O5,
2691    o6: O6,
2692    o7: O7,
2693    o0_default_fn: D0,
2694    o1_default_fn: D1,
2695    o2_default_fn: D2,
2696    o3_default_fn: D3,
2697    o4_default_fn: D4,
2698    o5_default_fn: D5,
2699    o6_default_fn: D6,
2700    o7_default_fn: D7,
2701
2702    o0_latest_value: Option<O0::Item>,
2703    o1_latest_value: Option<O1::Item>,
2704    o2_latest_value: Option<O2::Item>,
2705    o3_latest_value: Option<O3::Item>,
2706    o4_latest_value: Option<O4::Item>,
2707    o5_latest_value: Option<O5::Item>,
2708    o6_latest_value: Option<O6::Item>,
2709    o7_latest_value: Option<O7::Item>,
2710}
2711
2712impl<R0, R1, O0, O1, O2, O3, O4, O5, O6, O7, D0, D1, D2, D3, D4, D5, D6, D7> Iterator
2713    for ClampedZip2x8<R0, R1, O0, O1, O2, O3, O4, O5, O6, O7, D0, D1, D2, D3, D4, D5, D6, D7>
2714where
2715    R0: Iterator,
2716    R1: Iterator,
2717    O0: Iterator,
2718    O0::Item: Clone,
2719    O1: Iterator,
2720    O1::Item: Clone,
2721    O2: Iterator,
2722    O2::Item: Clone,
2723    O3: Iterator,
2724    O3::Item: Clone,
2725    O4: Iterator,
2726    O4::Item: Clone,
2727    O5: Iterator,
2728    O5::Item: Clone,
2729    O6: Iterator,
2730    O6::Item: Clone,
2731    O7: Iterator,
2732    O7::Item: Clone,
2733    D0: Fn() -> O0::Item,
2734    D1: Fn() -> O1::Item,
2735    D2: Fn() -> O2::Item,
2736    D3: Fn() -> O3::Item,
2737    D4: Fn() -> O4::Item,
2738    D5: Fn() -> O5::Item,
2739    D6: Fn() -> O6::Item,
2740    D7: Fn() -> O7::Item,
2741{
2742    type Item = (
2743        R0::Item,
2744        R1::Item,
2745        O0::Item,
2746        O1::Item,
2747        O2::Item,
2748        O3::Item,
2749        O4::Item,
2750        O5::Item,
2751        O6::Item,
2752        O7::Item,
2753    );
2754
2755    #[inline]
2756    fn next(&mut self) -> Option<Self::Item> {
2757        let r0_next = self.r0.next()?;
2758        let r1_next = self.r1.next()?;
2759        let o0_next = self.o0.next().or(self.o0_latest_value.take());
2760        let o1_next = self.o1.next().or(self.o1_latest_value.take());
2761        let o2_next = self.o2.next().or(self.o2_latest_value.take());
2762        let o3_next = self.o3.next().or(self.o3_latest_value.take());
2763        let o4_next = self.o4.next().or(self.o4_latest_value.take());
2764        let o5_next = self.o5.next().or(self.o5_latest_value.take());
2765        let o6_next = self.o6.next().or(self.o6_latest_value.take());
2766        let o7_next = self.o7.next().or(self.o7_latest_value.take());
2767
2768        self.o0_latest_value.clone_from(&o0_next);
2769        self.o1_latest_value.clone_from(&o1_next);
2770        self.o2_latest_value.clone_from(&o2_next);
2771        self.o3_latest_value.clone_from(&o3_next);
2772        self.o4_latest_value.clone_from(&o4_next);
2773        self.o5_latest_value.clone_from(&o5_next);
2774        self.o6_latest_value.clone_from(&o6_next);
2775        self.o7_latest_value.clone_from(&o7_next);
2776
2777        Some((
2778            r0_next,
2779            r1_next,
2780            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
2781            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
2782            o2_next.unwrap_or_else(|| (self.o2_default_fn)()),
2783            o3_next.unwrap_or_else(|| (self.o3_default_fn)()),
2784            o4_next.unwrap_or_else(|| (self.o4_default_fn)()),
2785            o5_next.unwrap_or_else(|| (self.o5_default_fn)()),
2786            o6_next.unwrap_or_else(|| (self.o6_default_fn)()),
2787            o7_next.unwrap_or_else(|| (self.o7_default_fn)()),
2788        ))
2789    }
2790}
2791
2792/// Returns a new [`ClampedZip2x9`] iterator.
2793///
2794/// The number of elements in a clamped zip iterator corresponds to the number of elements in the
2795/// shortest of its required iterators (`r0`, `r1`).
2796///
2797/// Optional iterators (`o0`, `o1`, `o2`, `o3`, `o4`, `o5`, `o6`, `o7`, `o8`) will repeat their latest values if they happen to be too short
2798/// to be zipped with the shortest of the required iterators.
2799///
2800/// If an optional iterator is not only too short but actually empty, its associated default function
2801/// (`o0_default_fn`, `o1_default_fn`, `o2_default_fn`, `o3_default_fn`, `o4_default_fn`, `o5_default_fn`, `o6_default_fn`, `o7_default_fn`, `o8_default_fn`) will be executed and the resulting value repeated as necessary.
2802pub fn clamped_zip_2x9<
2803    R0,
2804    R1,
2805    O0,
2806    O1,
2807    O2,
2808    O3,
2809    O4,
2810    O5,
2811    O6,
2812    O7,
2813    O8,
2814    D0,
2815    D1,
2816    D2,
2817    D3,
2818    D4,
2819    D5,
2820    D6,
2821    D7,
2822    D8,
2823>(
2824    r0: R0,
2825    r1: R1,
2826    o0: O0,
2827    o0_default_fn: D0,
2828    o1: O1,
2829    o1_default_fn: D1,
2830    o2: O2,
2831    o2_default_fn: D2,
2832    o3: O3,
2833    o3_default_fn: D3,
2834    o4: O4,
2835    o4_default_fn: D4,
2836    o5: O5,
2837    o5_default_fn: D5,
2838    o6: O6,
2839    o6_default_fn: D6,
2840    o7: O7,
2841    o7_default_fn: D7,
2842    o8: O8,
2843    o8_default_fn: D8,
2844) -> ClampedZip2x9<
2845    R0::IntoIter,
2846    R1::IntoIter,
2847    O0::IntoIter,
2848    O1::IntoIter,
2849    O2::IntoIter,
2850    O3::IntoIter,
2851    O4::IntoIter,
2852    O5::IntoIter,
2853    O6::IntoIter,
2854    O7::IntoIter,
2855    O8::IntoIter,
2856    D0,
2857    D1,
2858    D2,
2859    D3,
2860    D4,
2861    D5,
2862    D6,
2863    D7,
2864    D8,
2865>
2866where
2867    R0: IntoIterator,
2868    R1: IntoIterator,
2869    O0: IntoIterator,
2870    O0::Item: Clone,
2871    O1: IntoIterator,
2872    O1::Item: Clone,
2873    O2: IntoIterator,
2874    O2::Item: Clone,
2875    O3: IntoIterator,
2876    O3::Item: Clone,
2877    O4: IntoIterator,
2878    O4::Item: Clone,
2879    O5: IntoIterator,
2880    O5::Item: Clone,
2881    O6: IntoIterator,
2882    O6::Item: Clone,
2883    O7: IntoIterator,
2884    O7::Item: Clone,
2885    O8: IntoIterator,
2886    O8::Item: Clone,
2887    D0: Fn() -> O0::Item,
2888    D1: Fn() -> O1::Item,
2889    D2: Fn() -> O2::Item,
2890    D3: Fn() -> O3::Item,
2891    D4: Fn() -> O4::Item,
2892    D5: Fn() -> O5::Item,
2893    D6: Fn() -> O6::Item,
2894    D7: Fn() -> O7::Item,
2895    D8: Fn() -> O8::Item,
2896{
2897    ClampedZip2x9 {
2898        r0: r0.into_iter(),
2899        r1: r1.into_iter(),
2900        o0: o0.into_iter(),
2901        o1: o1.into_iter(),
2902        o2: o2.into_iter(),
2903        o3: o3.into_iter(),
2904        o4: o4.into_iter(),
2905        o5: o5.into_iter(),
2906        o6: o6.into_iter(),
2907        o7: o7.into_iter(),
2908        o8: o8.into_iter(),
2909        o0_default_fn,
2910        o1_default_fn,
2911        o2_default_fn,
2912        o3_default_fn,
2913        o4_default_fn,
2914        o5_default_fn,
2915        o6_default_fn,
2916        o7_default_fn,
2917        o8_default_fn,
2918        o0_latest_value: None,
2919        o1_latest_value: None,
2920        o2_latest_value: None,
2921        o3_latest_value: None,
2922        o4_latest_value: None,
2923        o5_latest_value: None,
2924        o6_latest_value: None,
2925        o7_latest_value: None,
2926        o8_latest_value: None,
2927    }
2928}
2929
2930/// Implements a clamped zip iterator combinator with 2 required iterators and 2 optional
2931/// iterators.
2932///
2933/// See [`clamped_zip_2x9`] for more information.
2934pub struct ClampedZip2x9<
2935    R0,
2936    R1,
2937    O0,
2938    O1,
2939    O2,
2940    O3,
2941    O4,
2942    O5,
2943    O6,
2944    O7,
2945    O8,
2946    D0,
2947    D1,
2948    D2,
2949    D3,
2950    D4,
2951    D5,
2952    D6,
2953    D7,
2954    D8,
2955> where
2956    R0: Iterator,
2957    R1: Iterator,
2958    O0: Iterator,
2959    O0::Item: Clone,
2960    O1: Iterator,
2961    O1::Item: Clone,
2962    O2: Iterator,
2963    O2::Item: Clone,
2964    O3: Iterator,
2965    O3::Item: Clone,
2966    O4: Iterator,
2967    O4::Item: Clone,
2968    O5: Iterator,
2969    O5::Item: Clone,
2970    O6: Iterator,
2971    O6::Item: Clone,
2972    O7: Iterator,
2973    O7::Item: Clone,
2974    O8: Iterator,
2975    O8::Item: Clone,
2976    D0: Fn() -> O0::Item,
2977    D1: Fn() -> O1::Item,
2978    D2: Fn() -> O2::Item,
2979    D3: Fn() -> O3::Item,
2980    D4: Fn() -> O4::Item,
2981    D5: Fn() -> O5::Item,
2982    D6: Fn() -> O6::Item,
2983    D7: Fn() -> O7::Item,
2984    D8: Fn() -> O8::Item,
2985{
2986    r0: R0,
2987    r1: R1,
2988    o0: O0,
2989    o1: O1,
2990    o2: O2,
2991    o3: O3,
2992    o4: O4,
2993    o5: O5,
2994    o6: O6,
2995    o7: O7,
2996    o8: O8,
2997    o0_default_fn: D0,
2998    o1_default_fn: D1,
2999    o2_default_fn: D2,
3000    o3_default_fn: D3,
3001    o4_default_fn: D4,
3002    o5_default_fn: D5,
3003    o6_default_fn: D6,
3004    o7_default_fn: D7,
3005    o8_default_fn: D8,
3006
3007    o0_latest_value: Option<O0::Item>,
3008    o1_latest_value: Option<O1::Item>,
3009    o2_latest_value: Option<O2::Item>,
3010    o3_latest_value: Option<O3::Item>,
3011    o4_latest_value: Option<O4::Item>,
3012    o5_latest_value: Option<O5::Item>,
3013    o6_latest_value: Option<O6::Item>,
3014    o7_latest_value: Option<O7::Item>,
3015    o8_latest_value: Option<O8::Item>,
3016}
3017
3018impl<R0, R1, O0, O1, O2, O3, O4, O5, O6, O7, O8, D0, D1, D2, D3, D4, D5, D6, D7, D8> Iterator
3019    for ClampedZip2x9<
3020        R0,
3021        R1,
3022        O0,
3023        O1,
3024        O2,
3025        O3,
3026        O4,
3027        O5,
3028        O6,
3029        O7,
3030        O8,
3031        D0,
3032        D1,
3033        D2,
3034        D3,
3035        D4,
3036        D5,
3037        D6,
3038        D7,
3039        D8,
3040    >
3041where
3042    R0: Iterator,
3043    R1: Iterator,
3044    O0: Iterator,
3045    O0::Item: Clone,
3046    O1: Iterator,
3047    O1::Item: Clone,
3048    O2: Iterator,
3049    O2::Item: Clone,
3050    O3: Iterator,
3051    O3::Item: Clone,
3052    O4: Iterator,
3053    O4::Item: Clone,
3054    O5: Iterator,
3055    O5::Item: Clone,
3056    O6: Iterator,
3057    O6::Item: Clone,
3058    O7: Iterator,
3059    O7::Item: Clone,
3060    O8: Iterator,
3061    O8::Item: Clone,
3062    D0: Fn() -> O0::Item,
3063    D1: Fn() -> O1::Item,
3064    D2: Fn() -> O2::Item,
3065    D3: Fn() -> O3::Item,
3066    D4: Fn() -> O4::Item,
3067    D5: Fn() -> O5::Item,
3068    D6: Fn() -> O6::Item,
3069    D7: Fn() -> O7::Item,
3070    D8: Fn() -> O8::Item,
3071{
3072    type Item = (
3073        R0::Item,
3074        R1::Item,
3075        O0::Item,
3076        O1::Item,
3077        O2::Item,
3078        O3::Item,
3079        O4::Item,
3080        O5::Item,
3081        O6::Item,
3082        O7::Item,
3083        O8::Item,
3084    );
3085
3086    #[inline]
3087    fn next(&mut self) -> Option<Self::Item> {
3088        let r0_next = self.r0.next()?;
3089        let r1_next = self.r1.next()?;
3090        let o0_next = self.o0.next().or(self.o0_latest_value.take());
3091        let o1_next = self.o1.next().or(self.o1_latest_value.take());
3092        let o2_next = self.o2.next().or(self.o2_latest_value.take());
3093        let o3_next = self.o3.next().or(self.o3_latest_value.take());
3094        let o4_next = self.o4.next().or(self.o4_latest_value.take());
3095        let o5_next = self.o5.next().or(self.o5_latest_value.take());
3096        let o6_next = self.o6.next().or(self.o6_latest_value.take());
3097        let o7_next = self.o7.next().or(self.o7_latest_value.take());
3098        let o8_next = self.o8.next().or(self.o8_latest_value.take());
3099
3100        self.o0_latest_value.clone_from(&o0_next);
3101        self.o1_latest_value.clone_from(&o1_next);
3102        self.o2_latest_value.clone_from(&o2_next);
3103        self.o3_latest_value.clone_from(&o3_next);
3104        self.o4_latest_value.clone_from(&o4_next);
3105        self.o5_latest_value.clone_from(&o5_next);
3106        self.o6_latest_value.clone_from(&o6_next);
3107        self.o7_latest_value.clone_from(&o7_next);
3108        self.o8_latest_value.clone_from(&o8_next);
3109
3110        Some((
3111            r0_next,
3112            r1_next,
3113            o0_next.unwrap_or_else(|| (self.o0_default_fn)()),
3114            o1_next.unwrap_or_else(|| (self.o1_default_fn)()),
3115            o2_next.unwrap_or_else(|| (self.o2_default_fn)()),
3116            o3_next.unwrap_or_else(|| (self.o3_default_fn)()),
3117            o4_next.unwrap_or_else(|| (self.o4_default_fn)()),
3118            o5_next.unwrap_or_else(|| (self.o5_default_fn)()),
3119            o6_next.unwrap_or_else(|| (self.o6_default_fn)()),
3120            o7_next.unwrap_or_else(|| (self.o7_default_fn)()),
3121            o8_next.unwrap_or_else(|| (self.o8_default_fn)()),
3122        ))
3123    }
3124}