pub struct TaskExecutor { /* fields omitted */ }
Executes futures on the runtime
All futures spawned using this executor will be submitted to the associated
Runtime's executor. This executor is usually a thread pool.
For more details, see the module level documentation.
Spawn a future onto the Tokio runtime.
This spawns the given future onto the runtime's executor, usually a
thread pool. The thread pool is then responsible for polling the future
until it completes.
See module level documentation for more details.
use tokio::runtime::Runtime;
let mut rt = Runtime::new().unwrap();
let executor = rt.executor();
executor.spawn(future::lazy(|| {
println!("now running on a worker thread");
Ok(())
}));
This function panics if the spawn fails. Failure occurs if the executor
is currently at capacity and is unable to spawn a new future.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Spawns a future to run on this Executor
, typically in the "background". Read more
Spawns a future object to run on this executor. Read more
Provides a best effort hint to whether or not spawn
will succeed. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static