Improve comment for FuturesOrdered and FuturesUnordered#2714
Improve comment for FuturesOrdered and FuturesUnordered#2714th4s wants to merge 1 commit intorust-lang:masterfrom
FuturesOrdered and FuturesUnordered#2714Conversation
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. |
|
☔ The latest upstream changes (possibly #3001) made this pull request unmergeable. Please resolve the merge conflicts. |
For
FuturesOrderedthere is a comment that says the futures would run in parallel, which is misleading.This PR makes clear that futures for
FuturesOrderedandFuturesUnorderedrun to completion concurrently instead of parallel.