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

Enhance Documentation: Alternatives to select! Macro #7110

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

Ddystopia
Copy link

This PR adds documentation for ecosystem alternatives to the select! macro, such as tokio_stream::StreamExt::merge and futures-concurrency utilities. Providing these alternatives helps users make informed decisions by showcasing additional tools and patterns, as a lot of new users are not aware of any alternatives to select!.

@Ddystopia Ddystopia force-pushed the master branch 3 times, most recently from c8f2fb0 to d31687f Compare January 18, 2025 15:48
@Darksonn Darksonn added T-docs Topic: documentation A-tokio Area: The main tokio crate M-macros Module: macros in the main Tokio crate labels Jan 18, 2025
@Ddystopia
Copy link
Author

Are there some issues with pr?

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Sorry, I forgot to click submit on my review.

My most general comment is that I'm not sure the selection of alternatives is complete. Surely we cannot discuss alternatives to the tokio::select! macro without mentioning the futures crate? It also has a macro called select! that is different from our macro in various ways.

More generally, Tokio usually links to futures over futures-lite because the futures crate is an official rust-lang project. As for futures-concurrency, I am okay with linking to that since the direct purpose of that crate is to investigate alternatives to select, so it is obvious to mention it.

tokio/src/macros/select.rs Outdated Show resolved Hide resolved
tokio/src/macros/select.rs Outdated Show resolved Hide resolved
tokio/src/macros/select.rs Outdated Show resolved Hide resolved
@Ddystopia
Copy link
Author

Thank you for the review, I've changed examples, moved the whole section after select! examples and focused motivation on cancellation safety issues

@Ddystopia
Copy link
Author

Oh, there is an infinite loop in example 😅

@Ddystopia Ddystopia requested a review from Darksonn January 29, 2025 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-macros Module: macros in the main Tokio crate T-docs Topic: documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants