1 //! Definition of the `Option` (optional step) combinator
2 
3 use {Future, Poll, Async};
4 
5 impl<F, T, E> Future for Option<F> where F: Future<Item=T, Error=E> {
6     type Item = Option<T>;
7     type Error = E;
8 
poll(&mut self) -> Poll<Option<T>, E>9     fn poll(&mut self) -> Poll<Option<T>, E> {
10         match *self {
11             None => Ok(Async::Ready(None)),
12             Some(ref mut x) => x.poll().map(|x| x.map(Some)),
13         }
14     }
15 }
16