Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use futures::{Future, Stream}; // 0.1.28
- pub fn take_first<S>(stream: S) -> impl Future<Item = Option<S::Item>, Error = S::Error>
- where
- S: Stream,
- {
- stream
- .into_future()
- .map(|(maybe_first, _rest_of_the_stream)| maybe_first)
- .map_err(|(err, _rest_of_the_stream)| err)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement