I have two iterators that I want to chain. That's easy: left.chain(right)
. But I also would like to get the index. Still easy: left.chain(right).enumerate()
. Except that I would like to skip a number when going from left to right. How can I do it?
I want to be able to do:
let left = ['a', 'b', 'c'].iter();
let right = ['e', 'f'].iter();
assert_eq!(
left.chain_enumerate_and_skip_one(right).collect(),
vec![(0, 'a'), (1, 'b'), (2, 'c'), /* not 3 */ (4, 'd'), (5, 'e')]);