/// `Update` is an iterator that mutates the elements of an /// underlying iterator before they are yielded. /// /// This struct is created by the [`update()`] method on [`ParallelIterator`] /// /// [`update()`]: trait.ParallelIterator.html#method.update /// [`ParallelIterator`]: trait.ParallelIterator.html #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[derive(Clone)] pubstruct Update<I: ParallelIterator, F> {
base: I,
update_op: F,
}
/// Standard Update adaptor, based on `itertools::adaptors::Update` #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[derive(Debug, Clone)] struct UpdateSeq<I, F> {
base: I,
update_op: F,
}
impl<I, F> Iterator for UpdateSeq<I, F> where
I: Iterator,
F: Fn(&mut I::Item),
{ type Item = I::Item;
// if possible, re-use inner iterator specializations in collect fn collect<C>(self) -> C where
C: ::std::iter::FromIterator<Self::Item>,
{ self.base.map(apply(self.update_op)).collect()
}
}
impl<I, F> ExactSizeIterator for UpdateSeq<I, F> where
I: ExactSizeIterator,
F: Fn(&mut I::Item),
{
}
impl<I, F> DoubleEndedIterator for UpdateSeq<I, F> where
I: DoubleEndedIterator,
F: Fn(&mut I::Item),
{ fn next_back(&mutself) -> Option<Self::Item> { letmut v = self.base.next_back()?;
(self.update_op)(&mut v);
Some(v)
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-06-26)
¤
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.