-
Notifications
You must be signed in to change notification settings - Fork 635
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
Improve comment for FuturesOrdered
and FuturesUnordered
#2714
base: master
Are you sure you want to change the base?
Improve comment for FuturesOrdered
and FuturesUnordered
#2714
Conversation
Make clear that futures run to completion concurrently instead of parallel.
What would be the correct approach to run them in parallel? I assume you have to spawn them as tasks, but this should probably be runtime-agnostic? What is the correct way to do this? Is it this one https://docs.rs/futures-util/latest/futures_util/task/trait.SpawnExt.html#method.spawn_with_handle ? |
Hmm, I’m not sure if there is a good way to do that without depending on an executor/runtime. |
So by "mention how to run them in parallel" you mean I should just add the comment that one needs to invoke |
I think this PR is helpful. There is some vagueness in existing docs as to what these 2 types are, and I think this PR makes it better.
@taiki-e I am also a bit confused by your comment. In order to run them in parallel you would have to spawn tasks, and this feels a bit out of context. |
The author of #2541 seems to think that a document that states "concurrent but not parallel" should also state "how to run in parallel" and I basically agree with that. However, if that is difficult, simply stating "concurrent but not parallel" would be fine. |
For
FuturesOrdered
there is a comment that says the futures would run in parallel, which is misleading.This PR makes clear that futures for
FuturesOrdered
andFuturesUnordered
run to completion concurrently instead of parallel.