diff options
author | Joel Galenson <jgalenson@google.com> | 2021-04-01 17:03:06 -0700 |
---|---|---|
committer | Joel Galenson <jgalenson@google.com> | 2021-04-01 17:03:06 -0700 |
commit | 6f798715de3d4bd744116190d14a413445542820 (patch) | |
tree | 70e883bc01ba2b4d8dd07e0347be18a2fbbd2c18 /src/ziptuple.rs | |
parent | a06122cf145ade58c23ae76bcf31d9c748dce354 (diff) | |
download | itertools-6f798715de3d4bd744116190d14a413445542820.tar.gz |
Upgrade rust/crates/itertools to 0.10.0android-s-beta-2android-s-beta-1
Test: make
Change-Id: Ie8b53cb0a96fd9adcbf7f4afa3b966849fc2ff24
Diffstat (limited to 'src/ziptuple.rs')
-rw-r--r-- | src/ziptuple.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/ziptuple.rs b/src/ziptuple.rs index 2dc3ea5..8f40193 100644 --- a/src/ziptuple.rs +++ b/src/ziptuple.rs @@ -98,6 +98,30 @@ macro_rules! impl_zip_iter { $B: ExactSizeIterator, )* { } + + #[allow(non_snake_case)] + impl<$($B),*> DoubleEndedIterator for Zip<($($B,)*)> where + $( + $B: DoubleEndedIterator + ExactSizeIterator, + )* + { + #[inline] + fn next_back(&mut self) -> Option<Self::Item> { + let ($(ref mut $B,)*) = self.t; + let size = *[$( $B.len(), )*].iter().min().unwrap(); + + $( + if $B.len() != size { + for _ in 0..$B.len() - size { $B.next_back(); } + } + )* + + match ($($B.next_back(),)*) { + ($(Some($B),)*) => Some(($($B,)*)), + _ => None, + } + } + } ); } @@ -109,3 +133,7 @@ impl_zip_iter!(A, B, C, D, E); impl_zip_iter!(A, B, C, D, E, F); impl_zip_iter!(A, B, C, D, E, F, G); impl_zip_iter!(A, B, C, D, E, F, G, H); +impl_zip_iter!(A, B, C, D, E, F, G, H, I); +impl_zip_iter!(A, B, C, D, E, F, G, H, I, J); +impl_zip_iter!(A, B, C, D, E, F, G, H, I, J, K); +impl_zip_iter!(A, B, C, D, E, F, G, H, I, J, K, L); |