Expand description
Async executors.
This crate provides two reference executors that trade performance for
functionality. They should be considered reference executors that are “good
enough” for most use cases. For more specialized use cases, consider writing
your own executor on top of async-task.
§Examples
use async_executor::Executor;
use futures_lite::future;
// Create a new executor.
let ex = Executor::new();
// Spawn a task.
let task = ex.spawn(async {
println!("Hello world");
});
// Run the executor until the task completes.
future::block_on(ex.run(task));Re-exports§
pub use async_task::FallibleTask;pub use async_task::Task;
Structs§
- Async
Call 🔒OnDrop - A wrapper around a future, running a closure when dropped.
- Call
OnDrop 🔒 - Runs a closure when dropped.
- Executor
- An async executor.
- Local
Executor - A thread-local executor.
- Runner 🔒
- A worker in a work-stealing executor.
- Sleepers 🔒
- A list of sleeping tickers.
- State 🔒
- The state of a executor.
- Ticker 🔒
- Runs task one by one.
Functions§
- _ensure_
send_ 🔒and_ sync - debug_
executor 🔒 - Debug implementation for
ExecutorandLocalExecutor. - debug_
state 🔒 - Debug implementation for
ExecutorandLocalExecutor. - steal 🔒
- Steals some items from one queue into another.