@@ -134,19 +134,19 @@ pub fn http_component(_attr: TokenStream, item: TokenStream) -> TokenStream {
134134
135135 impl From <self :: preamble:: wasi:: http:: types:: IncomingRequest > for :: spin_sdk:: http:: IncomingRequest {
136136 fn from( req: self :: preamble:: wasi:: http:: types:: IncomingRequest ) -> Self {
137- unsafe { Self :: from_handle( req. into_handle ( ) ) }
137+ unsafe { Self :: from_handle( req. take_handle ( ) ) }
138138 }
139139 }
140140
141141 impl From <:: spin_sdk:: http:: OutgoingResponse > for self :: preamble:: wasi:: http:: types:: OutgoingResponse {
142142 fn from( resp: :: spin_sdk:: http:: OutgoingResponse ) -> Self {
143- unsafe { Self :: from_handle( resp. into_handle ( ) ) }
143+ unsafe { Self :: from_handle( resp. take_handle ( ) ) }
144144 }
145145 }
146146
147147 impl From <self :: preamble:: wasi:: http:: types:: ResponseOutparam > for :: spin_sdk:: http:: ResponseOutparam {
148148 fn from( resp: self :: preamble:: wasi:: http:: types:: ResponseOutparam ) -> Self {
149- unsafe { Self :: from_handle( resp. into_handle ( ) ) }
149+ unsafe { Self :: from_handle( resp. take_handle ( ) ) }
150150 }
151151 }
152152 }
@@ -162,10 +162,6 @@ enum Export {
162162}
163163
164164fn preamble ( export : Export ) -> proc_macro2:: TokenStream {
165- let export_decl = match export {
166- Export :: WasiHttp => quote ! ( "wasi:http/incoming-handler" : Spin ) ,
167- Export :: Redis => quote ! ( "fermyon:spin/inbound-redis" : Spin ) ,
168- } ;
169165 let world = match export {
170166 Export :: WasiHttp => quote ! ( "wasi-http-trigger" ) ,
171167 Export :: Redis => quote ! ( "redis-trigger" ) ,
@@ -176,10 +172,9 @@ fn preamble(export: Export) -> proc_macro2::TokenStream {
176172 world: #world,
177173 path: #WIT_PATH ,
178174 runtime_path: "::spin_sdk::wit_bindgen::rt" ,
179- exports: {
180- #export_decl
181- }
175+ generate_all,
182176 } ) ;
183177 pub struct Spin ;
178+ export!( Spin ) ;
184179 }
185180}
0 commit comments