Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Calls an async WASM function with Wasmtime.
# wasmtime/demo/async.rs
use wasmtime::*;
use futures::executor::block_on;
fn main() -> anyhow::Result<()> {
let engine = Engine::default();
let module = Module::from_file(&engine, "async.wasm")?;
let mut store = Store::new(&engine, ());
let instance = Instance::new(&mut store, &module, &[])?;
let func = instance.get_typed_func::<(), i32, _>(&mut store, "compute")?;
let result = block_on(func.call_async(&mut store, ()))?;
println!("Async result: {}", result);
Ok(())
}Wasmtime is a fast, secure, and production-grade WebAssembly runtime built by the Bytecode Alliance. It runs WebAssembly modules outside the browser-on servers, desktops, edge infrastructure, and embedded systems-using WASI for safe system interaction.
Origin & Creator
Originally created by Mozilla researchers in 2019; now maintained by the Bytecode Alliance (Fastly, Intel, Red Hat, Microsoft, etc.).
Industrial Note
Wasmtime is used heavily in serverless platforms, secure plugin systems, cloud-edge runtimes, and performance-sensitive WASI compute workloads.