]>
git.proxmox.com Git - rustc.git/blob - vendor/rustc-rayon/src/iter/zip_eq.rs
1 use super::plumbing
::*;
4 /// An [`IndexedParallelIterator`] that iterates over two parallel iterators of equal
5 /// length simultaneously.
7 /// This struct is created by the [`zip_eq`] method on [`IndexedParallelIterator`],
8 /// see its documentation for more information.
10 /// [`zip_eq`]: trait.IndexedParallelIterator.html#method.zip_eq
11 /// [`IndexedParallelIterator`]: trait.IndexedParallelIterator.html
12 #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
13 #[derive(Debug, Clone)]
14 pub struct ZipEq
<A
: IndexedParallelIterator
, B
: IndexedParallelIterator
> {
18 impl<A
, B
> ZipEq
<A
, B
>
20 A
: IndexedParallelIterator
,
21 B
: IndexedParallelIterator
,
23 /// Creates a new `ZipEq` iterator.
24 pub(super) fn new(a
: A
, b
: B
) -> Self {
26 zip
: super::Zip
::new(a
, b
),
31 impl<A
, B
> ParallelIterator
for ZipEq
<A
, B
>
33 A
: IndexedParallelIterator
,
34 B
: IndexedParallelIterator
,
36 type Item
= (A
::Item
, B
::Item
);
38 fn drive_unindexed
<C
>(self, consumer
: C
) -> C
::Result
40 C
: UnindexedConsumer
<Self::Item
>,
42 bridge(self.zip
, consumer
)
45 fn opt_len(&self) -> Option
<usize> {
50 impl<A
, B
> IndexedParallelIterator
for ZipEq
<A
, B
>
52 A
: IndexedParallelIterator
,
53 B
: IndexedParallelIterator
,
55 fn drive
<C
>(self, consumer
: C
) -> C
::Result
57 C
: Consumer
<Self::Item
>,
59 bridge(self.zip
, consumer
)
62 fn len(&self) -> usize {
66 fn with_producer
<CB
>(self, callback
: CB
) -> CB
::Output
68 CB
: ProducerCallback
<Self::Item
>,
70 self.zip
.with_producer(callback
)