A WASI context is runtime state that stores the WASI resources and configuration exposed to a WebAssembly execution. In a Wasmtime host, it belongs in application state alongside the WASI resource table. section 4.1
A Rust host configures the context by:
- Storing WasiCtx and ResourceTable in a State struct. section 4.1
- Implementing WasiView for context access and IoView for resource-table access. section 4.1
- Building WasiCtx with inherited standard output, then placing it in a Store. section 4.1
- Linking WASI before instantiating the component and calling greet. section 4.1
Passing standard output to a component
Create a WasiCtx with WasiCtxBuilder::new().inherit_stdout().build(), construct Store state with that context and a new ResourceTable, and run the component through the linked host. section 4.1
Figure 4.4 Wasmtime/WASI providing access to host capabilities to a Wasm guest
Use the architecture figure to trace how Wasmtime and WASI provide host capabilities to a WebAssembly guest. section 4.1
