While futures-lite does not provide high-order concurrency primitives like FuturesUnordered or for_each_concurrent to keep complexity low, it provides race and zip for handling two futures at once.
For a fixed number of futures:
Use the futures-concurrency crate to join or race a specific number of futures.
use futures_concurrency::prelude::*;
let (x, y, z) = (a, b, c).join().await;
For a variable number of futures:
It is recommended to use an executor like smol (which provides Executor and LocalExecutor) rather than trying to manage large sets of futures with combinators.
Implementing select! logic:
You can implement select! behavior using async/await and the race combinator:
let x = (
async move { a.await + 1 },
async move { b.await; 0 },
async move { c.await + 3 }
).race().await;
let x = (
async move { a.await + 1 },
async move { b.await; 0 },
async move { c.await + 3 }
).race().await;