Skip to main content

Module future

Module future 

Source
Expand description

Runtime-neutral helpers for Futures, built on the standard library only.

No reactor, timer or thread pool is involved, so none of it depends on tokio, async-std or any other runtime: block_on runs a future on the current thread, join and join_all combine futures on one task, and now_or_never and yield_now are the small building blocks around them.

Functionsยง

block_on
Runs future to completion on the current thread and returns its output.
join
Runs two futures concurrently and completes with both outputs, once both are done.
join_all
Runs any number of futures concurrently and completes with all their outputs, in the order the futures were given.
now_or_never
Polls future exactly once and returns its output if it was already ready.
yield_now
A future that gives other tasks a turn: it is pending once, then completes.