@@ -8,7 +8,7 @@ use crate::{
8
8
HostFutureIncomingResponse , HostIncomingRequest , HostIncomingResponse , HostOutgoingRequest ,
9
9
HostOutgoingResponse , HostResponseOutparam ,
10
10
} ,
11
- WasiHttpView ,
11
+ WasiHttpImpl , WasiHttpView ,
12
12
} ;
13
13
use anyhow:: Context ;
14
14
use std:: any:: Any ;
@@ -19,7 +19,10 @@ use wasmtime_wasi::{
19
19
Pollable , ResourceTableError ,
20
20
} ;
21
21
22
- impl crate :: bindings:: http:: types:: Host for dyn WasiHttpView + ' _ {
22
+ impl < T > crate :: bindings:: http:: types:: Host for WasiHttpImpl < T >
23
+ where
24
+ T : WasiHttpView ,
25
+ {
23
26
fn convert_error_code ( & mut self , err : crate :: HttpError ) -> wasmtime:: Result < types:: ErrorCode > {
24
27
err. downcast ( )
25
28
}
@@ -98,7 +101,10 @@ fn get_fields_mut<'a>(
98
101
}
99
102
}
100
103
101
- impl crate :: bindings:: http:: types:: HostFields for dyn WasiHttpView + ' _ {
104
+ impl < T > crate :: bindings:: http:: types:: HostFields for WasiHttpImpl < T >
105
+ where
106
+ T : WasiHttpView ,
107
+ {
102
108
fn new ( & mut self ) -> wasmtime:: Result < Resource < HostFields > > {
103
109
let id = self
104
110
. table ( )
@@ -285,7 +291,10 @@ impl crate::bindings::http::types::HostFields for dyn WasiHttpView + '_ {
285
291
}
286
292
}
287
293
288
- impl crate :: bindings:: http:: types:: HostIncomingRequest for dyn WasiHttpView + ' _ {
294
+ impl < T > crate :: bindings:: http:: types:: HostIncomingRequest for WasiHttpImpl < T >
295
+ where
296
+ T : WasiHttpView ,
297
+ {
289
298
fn method ( & mut self , id : Resource < HostIncomingRequest > ) -> wasmtime:: Result < Method > {
290
299
let method = self . table ( ) . get ( & id) ?. parts . method . clone ( ) ;
291
300
Ok ( method. into ( ) )
@@ -370,7 +379,10 @@ impl crate::bindings::http::types::HostIncomingRequest for dyn WasiHttpView + '_
370
379
}
371
380
}
372
381
373
- impl crate :: bindings:: http:: types:: HostOutgoingRequest for dyn WasiHttpView + ' _ {
382
+ impl < T > crate :: bindings:: http:: types:: HostOutgoingRequest for WasiHttpImpl < T >
383
+ where
384
+ T : WasiHttpView ,
385
+ {
374
386
fn new (
375
387
& mut self ,
376
388
headers : Resource < Headers > ,
@@ -556,7 +568,10 @@ impl crate::bindings::http::types::HostOutgoingRequest for dyn WasiHttpView + '_
556
568
}
557
569
}
558
570
559
- impl crate :: bindings:: http:: types:: HostResponseOutparam for dyn WasiHttpView + ' _ {
571
+ impl < T > crate :: bindings:: http:: types:: HostResponseOutparam for WasiHttpImpl < T >
572
+ where
573
+ T : WasiHttpView ,
574
+ {
560
575
fn drop ( & mut self , id : Resource < HostResponseOutparam > ) -> wasmtime:: Result < ( ) > {
561
576
let _ = self . table ( ) . delete ( id) ?;
562
577
Ok ( ( ) )
@@ -579,7 +594,10 @@ impl crate::bindings::http::types::HostResponseOutparam for dyn WasiHttpView + '
579
594
}
580
595
}
581
596
582
- impl crate :: bindings:: http:: types:: HostIncomingResponse for dyn WasiHttpView + ' _ {
597
+ impl < T > crate :: bindings:: http:: types:: HostIncomingResponse for WasiHttpImpl < T >
598
+ where
599
+ T : WasiHttpView ,
600
+ {
583
601
fn drop ( & mut self , response : Resource < HostIncomingResponse > ) -> wasmtime:: Result < ( ) > {
584
602
let _ = self
585
603
. table ( )
@@ -640,7 +658,10 @@ impl crate::bindings::http::types::HostIncomingResponse for dyn WasiHttpView + '
640
658
}
641
659
}
642
660
643
- impl crate :: bindings:: http:: types:: HostFutureTrailers for dyn WasiHttpView + ' _ {
661
+ impl < T > crate :: bindings:: http:: types:: HostFutureTrailers for WasiHttpImpl < T >
662
+ where
663
+ T : WasiHttpView ,
664
+ {
644
665
fn drop ( & mut self , id : Resource < HostFutureTrailers > ) -> wasmtime:: Result < ( ) > {
645
666
let _ = self
646
667
. table ( )
@@ -687,7 +708,10 @@ impl crate::bindings::http::types::HostFutureTrailers for dyn WasiHttpView + '_
687
708
}
688
709
}
689
710
690
- impl crate :: bindings:: http:: types:: HostIncomingBody for dyn WasiHttpView + ' _ {
711
+ impl < T > crate :: bindings:: http:: types:: HostIncomingBody for WasiHttpImpl < T >
712
+ where
713
+ T : WasiHttpView ,
714
+ {
691
715
fn stream (
692
716
& mut self ,
693
717
id : Resource < HostIncomingBody > ,
@@ -718,7 +742,10 @@ impl crate::bindings::http::types::HostIncomingBody for dyn WasiHttpView + '_ {
718
742
}
719
743
}
720
744
721
- impl crate :: bindings:: http:: types:: HostOutgoingResponse for dyn WasiHttpView + ' _ {
745
+ impl < T > crate :: bindings:: http:: types:: HostOutgoingResponse for WasiHttpImpl < T >
746
+ where
747
+ T : WasiHttpView ,
748
+ {
722
749
fn new (
723
750
& mut self ,
724
751
headers : Resource < Headers > ,
@@ -807,7 +834,10 @@ impl crate::bindings::http::types::HostOutgoingResponse for dyn WasiHttpView + '
807
834
}
808
835
}
809
836
810
- impl crate :: bindings:: http:: types:: HostFutureIncomingResponse for dyn WasiHttpView + ' _ {
837
+ impl < T > crate :: bindings:: http:: types:: HostFutureIncomingResponse for WasiHttpImpl < T >
838
+ where
839
+ T : WasiHttpView ,
840
+ {
811
841
fn drop ( & mut self , id : Resource < HostFutureIncomingResponse > ) -> wasmtime:: Result < ( ) > {
812
842
let _ = self . table ( ) . delete ( id) ?;
813
843
Ok ( ( ) )
@@ -866,7 +896,10 @@ impl crate::bindings::http::types::HostFutureIncomingResponse for dyn WasiHttpVi
866
896
}
867
897
}
868
898
869
- impl crate :: bindings:: http:: types:: HostOutgoingBody for dyn WasiHttpView + ' _ {
899
+ impl < T > crate :: bindings:: http:: types:: HostOutgoingBody for WasiHttpImpl < T >
900
+ where
901
+ T : WasiHttpView ,
902
+ {
870
903
fn write (
871
904
& mut self ,
872
905
id : Resource < HostOutgoingBody > ,
@@ -903,7 +936,10 @@ impl crate::bindings::http::types::HostOutgoingBody for dyn WasiHttpView + '_ {
903
936
}
904
937
}
905
938
906
- impl crate :: bindings:: http:: types:: HostRequestOptions for dyn WasiHttpView + ' _ {
939
+ impl < T > crate :: bindings:: http:: types:: HostRequestOptions for WasiHttpImpl < T >
940
+ where
941
+ T : WasiHttpView ,
942
+ {
907
943
fn new ( & mut self ) -> wasmtime:: Result < Resource < types:: RequestOptions > > {
908
944
let id = self . table ( ) . push ( types:: RequestOptions :: default ( ) ) ?;
909
945
Ok ( id)
0 commit comments