select_all() or race_all()?
Qix- opened this issue · comments
The futures
package has a select_all()
function that races a collection of futures and returns the first resolved future's index without dropping the rest.
Is there a way to do this in async-std? I'd rather not pull in the entirety of futures
just for one function call 😅 I see there's a .race()
method somewhere but it's not immediately clear on how to use it for something like this, or if it will drop the "losing" future.
Thanks for any information!
Thanks for asking; that's a good question! We're working on new versions of these operations in the futures-concurrency
crate, with an eye of creating primitives which we put up for inclusion in the stdlib as well. Once we're happy with the design the plan is to re-export them from async-std
. Until then I can recommend using those operations directly from the futures-concurrency
crate.
I hope that answers your question!
So to be clear, futures-concurrency
has candidate members that will ultimately be exposed directly from async-std
in the future, right?
That's the goal, indeed.
Cool! Thanks :)