1 #![expect(clippy::allow_attributes_without_reason)]
2 
3 use wasmtime::component::{HasData, ResourceTable};
4 use wasmtime_wasi::{WasiCtx, WasiCtxView, WasiView};
5 
6 pub mod borrowing_host;
7 pub mod closed_streams;
8 pub mod resource_stream;
9 pub mod round_trip;
10 pub mod round_trip_direct;
11 pub mod round_trip_many;
12 pub mod transmit;
13 pub mod util;
14 pub mod yield_;
15 pub mod yield_runner;
16 
17 /// Host implementation, usable primarily by tests
18 pub struct Ctx {
19     pub wasi: WasiCtx,
20     pub table: ResourceTable,
21     pub continue_: bool,
22 }
23 
24 impl WasiView for Ctx {
ctx(&mut self) -> WasiCtxView<'_>25     fn ctx(&mut self) -> WasiCtxView<'_> {
26         WasiCtxView {
27             ctx: &mut self.wasi,
28             table: &mut self.table,
29         }
30     }
31 }
32 
33 impl HasData for Ctx {
34     type Data<'a> = &'a mut Self;
35 }
36