Created
June 29, 2018 18:03
-
-
Save panicbit/a477a75c740c6a85012eae6c98503e6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct OptionIter<I> { | |
iter: Option<I>, | |
} | |
impl<I> Iterator for OptionIter<I> | |
where | |
I: Iterator, | |
{ | |
type Item = Option<I::Item>; | |
fn next(&mut self) -> Option<Self::Item> { | |
match self.iter { | |
None => return Some(None), | |
Some(ref mut iter) => Some(iter.next()), | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment