From 6f798715de3d4bd744116190d14a413445542820 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Thu, 1 Apr 2021 17:03:06 -0700 Subject: Upgrade rust/crates/itertools to 0.10.0 Test: make Change-Id: Ie8b53cb0a96fd9adcbf7f4afa3b966849fc2ff24 --- src/ziptuple.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/ziptuple.rs') 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 { + 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); -- cgit v1.2.3