Expand description
This module provides an “ambient Tokio runtime”
with_ambient_tokio_runtime
. Embedders of wasmtime-wasi may do so from
synchronous Rust, and not use tokio directly. The implementation of
wasmtime-wasi requires a tokio executor in a way that is deeply tied to
its
design.
When used from a sychrnonous wasmtime context, this module provides the
wrapper function in_tokio
used throughout the shim implementations of
synchronous component binding Host
traits in terms of the async ones.
This module also provides a thin wrapper on tokio’s tasks.
AbortOnDropJoinHandle
, which is exactly like a
tokio::task::JoinHandle
except for the obvious behavioral change. This
whole crate, and any child crates which spawn tasks as part of their
implementations, should please use this crate’s spawn
and
spawn_blocking
over tokio’s. so we wanted the type name to stick out
if someone misses it.
Each of these facilities should be used by dependencies of wasmtime-wasi which when implementing component bindings.
Structs§
- Exactly like a
tokio::task::JoinHandle
, except that it aborts the task when the handle is dropped.
Functions§
- Attempts to get the result of a
future
. - Executes the closure
f
with an “ambient Tokio runtime” which basically means that if code inf
tries to get a runtimeHandle
it’ll succeed.