//! Extensions use super::*; use std::{ iter::{self, Fuse,} }; pub trait TaekTwoExt: Iterator { fn take_two(self) -> TakeTwo; } #[derive(Debug, Clone)] pub struct TakeTwo(I); impl + ?Sized> Iterator for TakeTwo { type Item = (T, Option); #[inline] fn next(&mut self) -> Option { let first = self.0.next()?; Some((first, self.0.next())) } } impl TaekTwoExt for I where I: Iterator + Sized { #[inline] fn take_two(self) -> TakeTwo { TakeTwo(self) } } //TODO: XXX: Copy all other iterator `ext` traits like `Collection: Extend, U: Into` (e.g. `String` with `char`) joining and such from older projects