Expand description
A library that adapts the popular async runtime tokio
for web browsers.
It provides a similar set of features specifically for web applications by leveraging the JavaScript web API.
This library includes JavaScript glue code
to mimic the behavior of real tokio
,
making it possible to run asynchronous Rust code in the browser.
Since tokio_with_wasm
adapts to the JavaScript event loop
and does not include its own runtime,
some advanced features of tokio
might not be fully supported.
Re-exports§
pub use crate as alias;
Modules§
- sync
- Synchronization primitives for use in asynchronous contexts.
- task
- Asynchronous green-threads.
- time
- Utilities for tracking time.
Macros§
- join
- Waits on multiple concurrent branches, returning when all branches complete.
- pin
- Pins a value on the stack.
- select
- Waits on multiple concurrent branches, returning when the first branch completes, cancelling the remaining branches.
- try_
join - Waits on multiple concurrent branches, returning when all branches
complete with
Ok(_)
or on the firstErr(_)
.
Functions§
- spawn
- Spawns a new asynchronous task, returning a
JoinHandle
for it.
Attribute Macros§
- main
- Attribute macro that mimics
tokio::main
. This macro returns a function that simply spawns the given future inside the JavaScript environment. To execute the function, you might need to use#[wasm_bindgen(start)]
in addition to this macro.