block_on
Runs future to completion on the current thread and returns its output.
A minimal executor with no dependency: it polls the future, and while it is pending parks the
thread until the future’s waker is called. There is no reactor, timer or thread pool, so it
suits futures that are purely computational or woken by another thread (channels, locks,
your own Waker users). A future that needs a specific runtime (tokio’s sockets or timers,
for instance) must run in that runtime instead, and blocking inside one would deadlock it.
Import
Section titled “Import”Cargo feature future (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
future | F | The future to run. |
Returns
Section titled “Returns”F::Output — The output of future.
