Skip to content

Add Stream::poll_next #145

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

Merged
merged 2 commits into from Sep 11, 2019
Merged

Add Stream::poll_next #145

merged 2 commits into from Sep 11, 2019

Conversation

ghost
Copy link

@ghost ghost commented Sep 4, 2019

Adding poll_next to the Stream trait will simplify #125.

After a discussion with @yoshuawuyts and @withoutboats, we became confident that the Stream trait of the future will never solely rely on async fn next() and will always have to rely on fn poll_next().

This PR now makes our Stream trait implementable by end users.

I also made a few adjustments around pinning to all() and any() combinators since they take a &mut self, which implies Self: Unpin. A rule of thumb is that if a method takes a &mut self and then pins self, we have to require Self: Unpin.

@ghost ghost requested a review from yoshuawuyts September 4, 2019 17:27
Copy link
Contributor

@yoshuawuyts yoshuawuyts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great!

@ghost
Copy link
Author

ghost commented Sep 11, 2019

bors r+

bors bot added a commit that referenced this pull request Sep 11, 2019
145: Add Stream::poll_next r=stjepang a=stjepang

Adding `poll_next` to the `Stream` trait will simplify #125.

After a discussion with @yoshuawuyts and @withoutboats, we became confident that the `Stream` trait of the future will never solely rely on `async fn next()` and will always have to rely on `fn poll_next()`.

This PR now makes our `Stream` trait implementable by end users.

I also made a few adjustments around pinning to `all()` and `any()` combinators since they take a `&mut self`, which implies `Self: Unpin`. A rule of thumb is that if a method takes a `&mut self` and then pins `self`, we *have to* require `Self: Unpin`.

Co-authored-by: Stjepan Glavina <[email protected]>
@bors
Copy link
Contributor

bors bot commented Sep 11, 2019

Build succeeded

  • continuous-integration/travis-ci/push

@bors bors bot merged commit 2497f4d into async-rs:master Sep 11, 2019
@ghost ghost deleted the poll_next branch September 11, 2019 17:32
@montekki montekki mentioned this pull request Sep 11, 2019
bors bot added a commit that referenced this pull request Sep 13, 2019
184: housekeeping after 145 r=yoshuawuyts a=montekki

Now that #145 is merged combinators can follow.
1. All combinators taking `&mut self` should imply `Self: Pin`.
2. Trait bounds are to `Stream`
3. Cleans up docs and `Debug` derives.

Co-authored-by: Fedor Sakharov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant