@@ -159,19 +159,19 @@ pub fn http_component(_attr: TokenStream, item: TokenStream) -> TokenStream {
159159
160160 impl From <self :: preamble:: wasi:: http:: types:: IncomingRequest > for :: spin_sdk:: http:: IncomingRequest {
161161 fn from( req: self :: preamble:: wasi:: http:: types:: IncomingRequest ) -> Self {
162- unsafe { Self :: from_handle( req. into_handle ( ) ) }
162+ unsafe { Self :: from_handle( req. take_handle ( ) ) }
163163 }
164164 }
165165
166166 impl From <:: spin_sdk:: http:: OutgoingResponse > for self :: preamble:: wasi:: http:: types:: OutgoingResponse {
167167 fn from( resp: :: spin_sdk:: http:: OutgoingResponse ) -> Self {
168- unsafe { Self :: from_handle( resp. into_handle ( ) ) }
168+ unsafe { Self :: from_handle( resp. take_handle ( ) ) }
169169 }
170170 }
171171
172172 impl From <self :: preamble:: wasi:: http:: types:: ResponseOutparam > for :: spin_sdk:: http:: ResponseOutparam {
173173 fn from( resp: self :: preamble:: wasi:: http:: types:: ResponseOutparam ) -> Self {
174- unsafe { Self :: from_handle( resp. into_handle ( ) ) }
174+ unsafe { Self :: from_handle( resp. take_handle ( ) ) }
175175 }
176176 }
177177 }
@@ -187,10 +187,6 @@ enum Export {
187187}
188188
189189fn preamble ( export : Export ) -> proc_macro2:: TokenStream {
190- let export_decl = match export {
191- Export :: WasiHttp => quote ! ( "wasi:http/incoming-handler" : Spin ) ,
192- Export :: Redis => quote ! ( "fermyon:spin/inbound-redis" : Spin ) ,
193- } ;
194190 let world = match export {
195191 Export :: WasiHttp => quote ! ( "wasi-http-trigger" ) ,
196192 Export :: Redis => quote ! ( "redis-trigger" ) ,
@@ -201,10 +197,9 @@ fn preamble(export: Export) -> proc_macro2::TokenStream {
201197 world: #world,
202198 path: #WIT_PATH ,
203199 runtime_path: "::spin_sdk::wit_bindgen::rt" ,
204- exports: {
205- #export_decl
206- }
200+ generate_all,
207201 } ) ;
208202 pub struct Spin ;
203+ export!( Spin ) ;
209204 }
210205}
0 commit comments