pub fn block_on<F: Future>(future: F) -> F::OutputExpand description
Run a single future to completion on a bespoke Tokio Runtime.
Every time you call this, a new instance of tokio::runtime::Runtime will
be created (see the implementation for details: it is trivial). This is:
-
Reasonable for teaching purposes, in that you do not generally need to set up more than one runtime anyway, and especially do not in basic code like we are showing!
-
Not that far off from what Tokio itself does under the hood in its own
tokio::mainmacro for supportingasync fn main.