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

concurrency: tokio::select vs. futures::select #2352

Open
fw-immunant opened this issue Sep 5, 2024 · 1 comment
Open

concurrency: tokio::select vs. futures::select #2352

fw-immunant opened this issue Sep 5, 2024 · 1 comment

Comments

@fw-immunant
Copy link
Collaborator

Currently when talking about combining futures, we introduce the futures::join macro and futures::join_all function, then tokio::select. But there is also a select macro in the futures library itself, though it has slightly different semantics and requirements: https://stackoverflow.com/questions/60811657/what-is-the-difference-between-futuresselect-and-tokioselect

In particular, the futures version requires futures to implement the FusedFuture trait and accesses them by mutable reference while the tokio variant moves futures (so users may instead pass &mut f) and does not require fusing.

We should at least mention the existence of the non-Tokio version so things don't seem so magical.

@djmitche
Copy link
Collaborator

This is a good point! And perhaps the higher-level takeaway is that async Rust, while usable in production, is still in the "few ways to do it, seeing what's best" phase, and further stabilization will eventually select one preferred way to do it.

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

No branches or pull requests

2 participants