Trait WasiView

Source
pub trait WasiView: Send {
    // Required method
    fn ctx(&mut self) -> WasiCtxView<'_>;
}
Expand description

A trait which provides access to the WasiCtx inside the embedder’s T of Store<T>.

This crate’s WASI Host implementations depend on the contents of WasiCtx. The T type Store<T> is defined in each embedding of Wasmtime. These implementations are connected to the Linker<T> by add_to_linker functions.

§Example

use wasmtime_wasi::{WasiCtx, WasiCtxView, WasiView};
use wasmtime::component::ResourceTable;

struct MyState {
    ctx: WasiCtx,
    table: ResourceTable,
}

impl WasiView for MyState {
    fn ctx(&mut self) -> WasiCtxView<'_> {
        WasiCtxView{
            ctx: &mut self.ctx,
            table: &mut self.table,
        }
    }
}

Required Methods§

Source

fn ctx(&mut self) -> WasiCtxView<'_>

Yields mutable access to the WasiCtx configuration used for this context.

Implementors§

Source§

impl WasiView for WasiP1Ctx

Available on crate feature p1 only.