Are there equivalents to slice::chunks/windows for iterators to loop over pairs, triplets etc?
It’s possible to take chunks of an iterator using Itertools::tuples, up to a 4-tuple: use itertools::Itertools; // 0.9.0 fn main() { let some_iter = vec![1, 2, 3, 4, 5, 6].into_iter(); for (prev, next) in some_iter.tuples() { println!(“{}–{}”, prev, next); } } (playground) 1–2 3–4 5–6 If you don’t know that your iterator exactly fits into … Read more