Crate tokio_current_thread
source · [−]Expand description
A single-threaded executor which executes tasks on the same thread from which they are spawned.
Note: This crate is deprecated in tokio 0.2.x and has been moved and refactored into various places in the
tokio
crate. The closest replacement is to make use oftokio::task::LocalSet::block_on
which requires thert-util
feature.
The crate provides:
CurrentThread
is the main type of this crate. It executes tasks on the current thread. The easiest way to start a newCurrentThread
executor is to callblock_on_all
with an initial task to seed the executor. All tasks that are being managed by aCurrentThread
executor are able to spawn additional tasks by callingspawn
.
Application authors will not use this crate directly. Instead, they will use the
tokio
crate. Library authors should only depend on tokio-current-thread
if they
are building a custom task executor.
For more details, see executor module documentation in the Tokio crate.
Structs
Error returned by the block_on
function.
Executes tasks on the current thread
A CurrentThread
instance bound to a supplied execution context.
Handle to spawn a future on the corresponding CurrentThread
instance
Error returned by the run
function.
Error returned by the run_timeout
function.
Executes futures on the current thread.
Returned by the turn
function.
Error returned by the turn
function.
Functions
Run the executor bootstrapping the execution with the provided future.
Executes a future on the current thread.