/// An iterator adaptor that consumes elements while the given predicate is /// `true`, including the element for which the predicate first returned /// `false`. /// /// See [`.take_while_inclusive()`](crate::Itertools::take_while_inclusive) /// for more information. #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[derive(Clone)] pubstruct TakeWhileInclusive<I, F> {
iter: I,
predicate: F,
done: bool,
}
impl<I, F> TakeWhileInclusive<I, F> where
I: Iterator,
F: FnMut(&I::Item) -> bool,
{ /// Create a new [`TakeWhileInclusive`] from an iterator and a predicate. pub(crate) fn new(iter: I, predicate: F) -> Self { Self {
iter,
predicate,
done: false,
}
}
}
impl<I, F> fmt::Debug for TakeWhileInclusive<I, F> where
I: Iterator + fmt::Debug,
{
debug_fmt_fields!(TakeWhileInclusive, iter, done);
}
impl<I, F> Iterator for TakeWhileInclusive<I, F> where
I: Iterator,
F: FnMut(&I::Item) -> bool,
{ type Item = I::Item;
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.