Skip to content
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

impl Stream for DelayQueue #1975

Merged
merged 1 commit into from
Dec 18, 2019
Merged

Conversation

rubdos
Copy link
Contributor

@rubdos rubdos commented Dec 17, 2019

Motivation

8a7e577 deleted impl Stream for DelayQueue. It also said

Since the Stream implementation is optional, types that are logically
streams provide async fn next_* functions to obtain the next value.
Avoiding the next() name prevents fn conflicts with StreamExt::next().

However, DelayQueue only provided poll_expired, which makes DelayQueue almost unusable in async contexts.

Solution

This PR implements Stream on DelayQueue behind the feature flag stream, which is only a few characters away from the origin implementation that existed before 8a7e577.


If a test is useful for this contribution, or any changes are needed, please let me know. I'm unsure what kind of test to implement for this, so a pointer to an example test for another module would be appreciated in that case.

Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

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

Thanks for doing this 👍

@carllerche carllerche merged commit 17e4241 into tokio-rs:master Dec 18, 2019
@rubdos rubdos deleted the delay-queue-stream-pr branch December 18, 2019 10:27
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.

2 participants