wash_lib/plugin/
mod.rs

1use wasmtime_wasi::{WasiCtx, WasiView};
2use wasmtime_wasi_http::{WasiHttpCtx, WasiHttpView};
3
4pub mod subcommand;
5
6/// The directory where plugins are stored.
7pub const PLUGIN_DIR: &str = "plugins";
8
9struct Data {
10    table: wasmtime::component::ResourceTable,
11    ctx: WasiCtx,
12    http: WasiHttpCtx,
13}
14
15impl WasiView for Data {
16    fn table(&mut self) -> &mut wasmtime::component::ResourceTable {
17        &mut self.table
18    }
19
20    fn ctx(&mut self) -> &mut WasiCtx {
21        &mut self.ctx
22    }
23}
24
25impl WasiHttpView for Data {
26    fn table(&mut self) -> &mut wasmtime::component::ResourceTable {
27        &mut self.table
28    }
29
30    fn ctx(&mut self) -> &mut WasiHttpCtx {
31        &mut self.http
32    }
33}