/// `Cloned` is an iterator that clones the elements of an underlying iterator. /// /// This struct is created by the [`cloned()`] method on [`ParallelIterator`] /// /// [`cloned()`]: trait.ParallelIterator.html#method.cloned /// [`ParallelIterator`]: trait.ParallelIterator.html #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[derive(Debug, Clone)] pubstruct Cloned<I: ParallelIterator> {
base: I,
}
impl<I> Cloned<I> where
I: ParallelIterator,
{ /// Creates a new `Cloned` iterator. pub(super) fn new(base: I) -> Self {
Cloned { base }
}
}
impl<'a, T, I> ParallelIterator for Cloned<I> where
I: ParallelIterator<Item = &'a T>,
T: 'a + Clone + Send + Sync,
{ type Item = T;
fn drive_unindexed<C>(self, consumer: C) -> C::Result where
C: UnindexedConsumer<Self::Item>,
{ let consumer1 = ClonedConsumer::new(consumer); self.base.drive_unindexed(consumer1)
}
impl<'a, T, P> Producer for ClonedProducer<P> where
P: Producer<Item = &'a T>,
T: 'a + Clone,
{ type Item = T; type IntoIter = iter::Cloned<P::IntoIter>;
impl<C> ClonedConsumer<C> { fn new(base: C) -> Self {
ClonedConsumer { base }
}
}
impl<'a, T, C> Consumer<&'a T> for ClonedConsumer<C> where
C: Consumer<T>,
T: 'a + Clone,
{ type Folder = ClonedFolder<C::Folder>; type Reducer = C::Reducer; type Result = C::Result;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.