Expand description
§Single-threaded executor
This executor works strictly in a single-threaded environment. In order to spawn a task, use
spawn
. To run the executor, use run
.
There is no need to create an instance of the executor, it’s automatically provisioned as a thread-local instance.
§Example
use tokio::sync::*;
use wasm_rs_async_executor::single_threaded::{spawn, run};
let (sender, receiver) = oneshot::channel::<()>();
let _task = spawn(async move {
// Complete when something is received
let _ = receiver.await;
});
// Send data to be received
let _ = sender.send(());
run(None);
Structs§
- Task
- Task information
- Task
Handle - Task handle
- Type
Info
Enums§
- Join
Error - Task joining error
Functions§
- block_
on - Run tasks until completion of a future
- evict_
all - Removes all tasks from the executor
- queued_
tasks - Returns tokens for queued tasks
- queued_
tasks_ count - Returns the number of tasks currently in the queue to execute
- run
- Run the executor
- spawn
- Spawn a task
- tasks
- Returns all tasks that haven’t completed yet
- tasks_
count - Returns the number of tasks currently registered with the executor