1use super::plumbing::*;
2use super::*;
3
4#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
12#[derive(Debug, Clone)]
13pub struct ZipEq<A, B> {
14 zip: Zip<A, B>,
15}
16
17impl<A, B> ZipEq<A, B> {
18 pub(super) fn new(a: A, b: B) -> Self {
20 ZipEq {
21 zip: super::Zip::new(a, b),
22 }
23 }
24}
25
26impl<A, B> ParallelIterator for ZipEq<A, B>
27where
28 A: IndexedParallelIterator,
29 B: IndexedParallelIterator,
30{
31 type Item = (A::Item, B::Item);
32
33 fn drive_unindexed<C>(self, consumer: C) -> C::Result
34 where
35 C: UnindexedConsumer<Self::Item>,
36 {
37 bridge(self.zip, consumer)
38 }
39
40 fn opt_len(&self) -> Option<usize> {
41 Some(self.zip.len())
42 }
43}
44
45impl<A, B> IndexedParallelIterator for ZipEq<A, B>
46where
47 A: IndexedParallelIterator,
48 B: IndexedParallelIterator,
49{
50 fn drive<C>(self, consumer: C) -> C::Result
51 where
52 C: Consumer<Self::Item>,
53 {
54 bridge(self.zip, consumer)
55 }
56
57 fn len(&self) -> usize {
58 self.zip.len()
59 }
60
61 fn with_producer<CB>(self, callback: CB) -> CB::Output
62 where
63 CB: ProducerCallback<Self::Item>,
64 {
65 self.zip.with_producer(callback)
66 }
67}