Module wasm_rs_async_executor::single_threaded [−][src]
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 handle |
TypeInfo |
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 |
yield_animation_frame | Yields to the browser using |
yield_async | Yields a future to the JavaScript environment using |
yield_timeout | Yields the JavaScript environment using |
yield_until_idle | Yields to the browser using |