-
Notifications
You must be signed in to change notification settings - Fork 631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add into_inner and similar methods to StreamFuture #722
add into_inner and similar methods to StreamFuture #722
Conversation
Thanks! Looks like CI may be failing? |
7c2a8a5
to
a072a1d
Compare
Pushed a fix. Helps if I had run |
Thanks! Could these functions actually return |
They could. That's an API design choice that is yours to make. From what I understand, the
Pushing the chance of panic to the developer seems like the better solution, although the fact that the stream is stored in an Option internally seems like an internal implementation detail of |
Yeah the convention so far that we're trying to stick to is to push the panics outwards, e.g. give you a chance to handle the case where the inner stream is gone. |
When selecting on a StreamFuture and other futures, it is useful to be able to recover the underlying Stream if one of the other futures resolves first. These methods return `Option` to account for the fact that `StreamFuture`'s implementation of `Future::poll` consumes the underlying stream during polling in order to return it to the caller of `Future::poll` if the stream yieleded an element.
a072a1d
to
767df28
Compare
The latest change has the Option return types and applicable documentation. |
Thanks! |
/// | ||
/// This method returns an `Option` to account for the fact that `StreamFuture`'s | ||
/// implementation of `Future::poll` consumes the underlying stream during polling | ||
/// in order to return it to the caller of `Future::poll` if the stream yieleded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yielded 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR for fix: #723
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And thanks. :)
When selecting on a StreamFuture and other futures, it is useful to be able to recover the underlying Stream if one of the other futures resolves first.
See #633 (comment) for more information.