From 8cdfa445d6629ffef4cb84967ff7017654045bc2 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 2 Jul 2025 18:36:06 -0600 Subject: chore: add vendor directory --- vendor/itertools/src/cons_tuples_impl.rs | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 vendor/itertools/src/cons_tuples_impl.rs (limited to 'vendor/itertools/src/cons_tuples_impl.rs') diff --git a/vendor/itertools/src/cons_tuples_impl.rs b/vendor/itertools/src/cons_tuples_impl.rs new file mode 100644 index 00000000..7e86260b --- /dev/null +++ b/vendor/itertools/src/cons_tuples_impl.rs @@ -0,0 +1,39 @@ +use crate::adaptors::map::{MapSpecialCase, MapSpecialCaseFn}; + +macro_rules! impl_cons_iter( + ($_A:ident, $_B:ident, ) => (); // stop + + ($A:ident, $($B:ident,)*) => ( + impl_cons_iter!($($B,)*); + #[allow(non_snake_case)] + impl<$($B),*, X> MapSpecialCaseFn<(($($B,)*), X)> for ConsTuplesFn { + type Out = ($($B,)* X, ); + fn call(&mut self, (($($B,)*), X): (($($B,)*), X)) -> Self::Out { + ($($B,)* X, ) + } + } + ); +); + +impl_cons_iter!(A, B, C, D, E, F, G, H, I, J, K, L,); + +#[derive(Debug, Clone)] +pub struct ConsTuplesFn; + +/// An iterator that maps an iterator of tuples like +/// `((A, B), C)` to an iterator of `(A, B, C)`. +/// +/// Used by the `iproduct!()` macro. +pub type ConsTuples = MapSpecialCase; + +/// Create an iterator that maps for example iterators of +/// `((A, B), C)` to `(A, B, C)`. +pub fn cons_tuples(iterable: I) -> ConsTuples +where + I: IntoIterator, +{ + ConsTuples { + iter: iterable.into_iter(), + f: ConsTuplesFn, + } +} -- cgit v1.2.3