The Wayback Machine - https://web.archive.org/web/20220510052139/https://github.com/rust-lang/futures-rs/pull/2262
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

Stream select macro #2262

Merged
merged 10 commits into from Jul 31, 2021
Merged

Stream select macro #2262

merged 10 commits into from Jul 31, 2021

Conversation

Copy link
Contributor

@Xaeroxe Xaeroxe commented Nov 13, 2020

Adds a new procedural macro to the futures crate that I've found some use for. stream_select! works similarly to the select_all function, but doesn't require the streams to all be the same type. Nor does it use a Box<dyn Stream> to accomplish that. It's implemented in terms of the select! macro , but represents a type rather than multiple branches of execution. In my use case I would feed the stream from stream_select! into a select! statement, as many of the streams I want to select! over should be treated identically in the select! statement.

Reviewers may ask "Why not just use the select function repeatedly?" And the answer to that is that recursive use of the select function results in an unfair stream, with priority being given to streams on the upper layers.

Copy link
Member

@taiki-e taiki-e left a comment

Thanks for the PR and sorry for the late review!

I think it makes sense to add a feature like this (this is actually a stream version of simple select), but I don't want to add features that rely on Fused{Future,Stream} because Fused{Future,Stream} will be removed in the next major version.

@taiki-e taiki-e added the S-waiting-on-author label Jun 16, 2021
@Xaeroxe
Copy link
Author

@Xaeroxe Xaeroxe commented Jun 23, 2021

@taiki-e I've removed the FusedStream dependency, this is now ready for review.

@taiki-e taiki-e removed the S-waiting-on-author label Jun 24, 2021
@taiki-e taiki-e self-requested a review Jun 24, 2021
Copy link
Member

@taiki-e taiki-e left a comment

impl LGTM. Sorry for the late review!

futures/tests/macro-tests/src/main.rs Outdated Show resolved Hide resolved
futures-macro/src/stream_select.rs Outdated Show resolved Hide resolved
@Xaeroxe
Copy link
Author

@Xaeroxe Xaeroxe commented Jul 30, 2021

@taiki-e ready for re-review, thank you!

Copy link
Member

@taiki-e taiki-e left a comment

LGTM. Thanks @Xaeroxe!

@taiki-e taiki-e merged commit 633a905 into rust-lang:master Jul 31, 2021
22 checks passed
@taiki-e taiki-e added the 0.3-backport: pending label Jul 31, 2021
taiki-e pushed a commit that referenced this issue Aug 28, 2021
@taiki-e taiki-e mentioned this pull request Aug 28, 2021
@taiki-e taiki-e added 0.3-backport: completed and removed 0.3-backport: pending labels Aug 28, 2021
taiki-e pushed a commit that referenced this issue Aug 30, 2021
@taiki-e taiki-e mentioned this pull request Aug 30, 2021
@taiki-e
Copy link

@taiki-e taiki-e commented Aug 30, 2021

Published in 0.3.17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants