Can I zip multiple iterators flattened?

Currently, if I zip 3 iterators, I get an iterator to (&T, (&U, &M)) and if I keep doing that I'll get more and more nested. I've seen rust - How can I zip more than two iterators? - Stack Overflow and the only solution I found was using the iter_tools.

Isn't there a way already? This question is more than 1 year old so maybe there's a way.

There isn't AFAIK. Doing this "properly", at the type level, would require variadic generics.

If you don't want to pull in itertools, you can write your own macro, it should be fairly straightforward.

Copying the itertools macro is your right. I don't remember who contributed it, a macro wizard for sure. :slight_smile:

(Edit: the wizard was @krdln )

1 Like