Skip to content

Commit d993d7a

Browse files
bors[bot]cuviper
andauthored
683: impl ParallelExtend<()> for () r=cuviper a=cuviper Mirrors rust-lang/rust#50234 Co-authored-by: Josh Stone <cuviper@gmail.com>
2 parents 2720d8d + c6a294b commit d993d7a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/iter/extend.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use super::noop::NoopConsumer;
12
use super::{IntoParallelIterator, ParallelExtend, ParallelIterator};
23

34
use std::borrow::Cow;
@@ -368,3 +369,13 @@ where
368369
self.par_extend(par_iter.into_par_iter().cloned())
369370
}
370371
}
372+
373+
/// Collapses all unit items from a parallel iterator into one.
374+
impl ParallelExtend<()> for () {
375+
fn par_extend<I>(&mut self, par_iter: I)
376+
where
377+
I: IntoParallelIterator<Item = ()>,
378+
{
379+
par_iter.into_par_iter().drive_unindexed(NoopConsumer)
380+
}
381+
}

0 commit comments

Comments
 (0)