/// An iterator that could be either of two iterators. #[derive(Clone, Debug)] pub enum EitherIter { A(A), B(B), } impl Iterator for EitherIter where A: Iterator, B: Iterator, { type Item = T; fn next(&mut self) -> Option { match self { EitherIter::A(iter) => iter.next(), EitherIter::B(iter) => iter.next(), } } }