[][src]Module async_runtime::rt

This is a convenience module for setting a default runtime and allowing code throughout to use [rt::spawn]. It means you don't have to pass an executor around everywhere.

For examples, please look in the examples directory of the repository.

Structs

Exec03

An executor that uses futures 0.3 LocalPool or juliex threadpool under the hood. Normally you don't need to construct this yourself, just use the rt module methods to spawn futures.

Functions

block_on

Block the current thread until the given future resolves and return the Output. This just forwards to futures::executor::block_on under the hood.

current_rt

Get the configuration for the current default executor. Note that if this returns None and you call spawn, a default executor will be initialized, after which this will no longer return None.

init

Set the executor to use by default. Run this before calls to spawn. If you are a library author, don't call this unless you create the thread, otherwise it's up to client code to decide which executor to use. Just call spawn.

run

Run all spawned futures to completion. This is a no-op for the threadpool. However you must run this after spawning on the local pool or futures won't be polled. Do not call it from within a spawned task, or your program will hang or panic.

spawn

Spawn a future to be run on the default executor (set with init or default, depending on juliex feature, see documentation for rt::init).

spawn_local

Spawn a future to be run on the LocalPool (current thread). This will return an error if the current executor is the threadpool.