pub trait WasiHttpView: Send {
// Required method
fn http(&mut self) -> WasiHttpCtxView<'_>;
}Expand description
A trait which provides internal WASI HTTP state.
This trait is used by the add_to_linker convenience functions of this
crate. This trait can be implemented for the T in Store<T> to provide
access to wasi:http information at runtime.
§Example
use wasmtime::component::ResourceTable;
use wasmtime_wasi_http::{WasiHttpCtx, WasiHttpView, WasiHttpCtxView};
struct MyState {
http_ctx: WasiHttpCtx,
table: ResourceTable,
}
impl WasiHttpView for MyState {
fn http(&mut self) -> WasiHttpCtxView<'_> {
WasiHttpCtxView {
ctx: &mut self.http_ctx,
table: &mut self.table,
hooks: Default::default(),
}
}
}Required Methods§
Sourcefn http(&mut self) -> WasiHttpCtxView<'_>
fn http(&mut self) -> WasiHttpCtxView<'_>
Return a WasiHttpCtxView from mutable reference to self.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".