diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:26:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:26:03 +0000 |
commit | 9918693037dce8aa4bb6f08741b6812923486c18 (patch) | |
tree | 21d2b40bec7e6a7ea664acee056eb3d08e15a1cf /vendor/itertools/src/take_while_inclusive.rs | |
parent | Releasing progress-linux version 1.75.0+dfsg1-5~progress7.99u1. (diff) | |
download | rustc-9918693037dce8aa4bb6f08741b6812923486c18.tar.xz rustc-9918693037dce8aa4bb6f08741b6812923486c18.zip |
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/itertools/src/take_while_inclusive.rs')
-rw-r--r-- | vendor/itertools/src/take_while_inclusive.rs | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/vendor/itertools/src/take_while_inclusive.rs b/vendor/itertools/src/take_while_inclusive.rs index e2a7479e0..5207d8a01 100644 --- a/vendor/itertools/src/take_while_inclusive.rs +++ b/vendor/itertools/src/take_while_inclusive.rs @@ -8,33 +8,39 @@ use std::fmt; /// See [`.take_while_inclusive()`](crate::Itertools::take_while_inclusive) /// for more information. #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -pub struct TakeWhileInclusive<'a, I: 'a, F> { - iter: &'a mut I, +#[derive(Clone)] +pub struct TakeWhileInclusive<I, F> { + iter: I, predicate: F, done: bool, } -impl<'a, I, F> TakeWhileInclusive<'a, I, F> +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 fn new(iter: &'a mut I, predicate: F) -> Self { - Self { iter, predicate, done: false} + pub fn new(iter: I, predicate: F) -> Self { + Self { + iter, + predicate, + done: false, + } } } -impl<'a, I, F> fmt::Debug for TakeWhileInclusive<'a, I, F> - where I: Iterator + fmt::Debug, +impl<I, F> fmt::Debug for TakeWhileInclusive<I, F> +where + I: Iterator + fmt::Debug, { debug_fmt_fields!(TakeWhileInclusive, iter); } -impl<'a, I, F> Iterator for TakeWhileInclusive<'a, I, F> +impl<I, F> Iterator for TakeWhileInclusive<I, F> where I: Iterator, - F: FnMut(&I::Item) -> bool + F: FnMut(&I::Item) -> bool, { type Item = I::Item; @@ -60,9 +66,9 @@ where } } -impl<I, F> FusedIterator for TakeWhileInclusive<'_, I, F> +impl<I, F> FusedIterator for TakeWhileInclusive<I, F> where I: Iterator, - F: FnMut(&I::Item) -> bool + F: FnMut(&I::Item) -> bool, { -}
\ No newline at end of file +} |