@@ -3,13 +3,9 @@ use core::future::Future;
33use bytes:: Bytes ;
44use wasmtime:: Store ;
55use wasmtime:: component:: { Component , Linker , ResourceTable } ;
6- use wasmtime_wasi:: clocks:: { WasiClocksCtx , WasiClocksView } ;
76use wasmtime_wasi:: p2:: { IoView , WasiCtx , WasiCtxBuilder , WasiView } ;
87use wasmtime_wasi:: p3:: ResourceView ;
9- use wasmtime_wasi:: p3:: cli:: { WasiCliCtx , WasiCliView } ;
108use wasmtime_wasi:: p3:: filesystem:: { WasiFilesystemCtx , WasiFilesystemView } ;
11- use wasmtime_wasi:: p3:: sockets:: { WasiSocketsCtx , WasiSocketsView } ;
12- use wasmtime_wasi:: random:: { WasiRandomCtx , WasiRandomView } ;
139use wasmtime_wasi_http:: p3:: bindings:: http:: types:: ErrorCode ;
1410use wasmtime_wasi_http:: p3:: {
1511 Client , DEFAULT_FORBIDDEN_HEADERS , RequestOptions , WasiHttpCtx , WasiHttpView ,
@@ -21,9 +17,7 @@ mod outgoing;
2117mod proxy;
2218
2319struct Ctx < C : Client = TestClient > {
24- cli : WasiCliCtx ,
2520 filesystem : WasiFilesystemCtx ,
26- sockets : WasiSocketsCtx ,
2721 table : ResourceTable ,
2822 wasip2 : WasiCtx ,
2923 wasip3 : wasmtime_wasi:: p3:: WasiCtx ,
3630{
3731 fn default ( ) -> Self {
3832 Self {
39- cli : WasiCliCtx :: default ( ) ,
4033 filesystem : WasiFilesystemCtx :: default ( ) ,
41- sockets : WasiSocketsCtx :: default ( ) ,
4234 table : ResourceTable :: default ( ) ,
4335 wasip2 : WasiCtxBuilder :: new ( ) . inherit_stdio ( ) . build ( ) ,
4436 wasip3 : wasmtime_wasi:: p3:: WasiCtxBuilder :: new ( )
@@ -62,8 +54,11 @@ impl<C: Client> IoView for Ctx<C> {
6254}
6355
6456impl < C : Client > wasmtime_wasi:: p3:: WasiView for Ctx < C > {
65- fn ctx ( & mut self ) -> & mut wasmtime_wasi:: p3:: WasiCtx {
66- & mut self . wasip3
57+ fn ctx ( & mut self ) -> wasmtime_wasi:: p3:: WasiCtxView < ' _ > {
58+ wasmtime_wasi:: p3:: WasiCtxView {
59+ ctx : & mut self . wasip3 ,
60+ table : & mut self . table ,
61+ }
6762 }
6863}
6964
@@ -73,36 +68,12 @@ impl<C: Client> ResourceView for Ctx<C> {
7368 }
7469}
7570
76- impl < C : Client > WasiCliView for Ctx < C > {
77- fn cli ( & mut self ) -> & WasiCliCtx {
78- & self . cli
79- }
80- }
81-
82- impl < C : Client > WasiClocksView for Ctx < C > {
83- fn clocks ( & mut self ) -> & WasiClocksCtx {
84- & self . wasip3 . clocks
85- }
86- }
87-
8871impl < C : Client > WasiFilesystemView for Ctx < C > {
8972 fn filesystem ( & self ) -> & WasiFilesystemCtx {
9073 & self . filesystem
9174 }
9275}
9376
94- impl < C : Client > WasiRandomView for Ctx < C > {
95- fn random ( & mut self ) -> & mut WasiRandomCtx {
96- & mut self . wasip3 . random
97- }
98- }
99-
100- impl < C : Client > WasiSocketsView for Ctx < C > {
101- fn sockets ( & self ) -> & WasiSocketsCtx {
102- & self . sockets
103- }
104- }
105-
10677impl < C : Client > WasiHttpView for Ctx < C > {
10778 type Client = C ;
10879
0 commit comments