blob: 03ed691ed612c481ec953203c01c0ee71325b18b (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
pub trait IterExt: Iterator {
fn just_one(&mut self) -> Option<Self::Item> {
let one = self.next()?;
match self.next() {
Some(_) => None,
None => Some(one),
}
}
}
impl<T: Iterator> IterExt for T {}
|