Skip to content

Commit de2be69

Browse files
committed
update macros to match new wit-bindgen version
Signed-off-by: Joel Dice <[email protected]>
1 parent 4ee3b10 commit de2be69

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

crates/macro/src/lib.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

164164
fn 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
}

src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ pub mod wit {
3838
pub use spin::postgres::postgres as pg3;
3939
}
4040

41-
/// Needed by the export macro
42-
///
43-
/// See [this commit](https://github.com/bytecodealliance/wit-bindgen/pull/394/commits/9d2ea88f986f4a883ba243449e3a070cac18958e) for more info.
44-
#[cfg(target_arch = "wasm32")]
45-
#[doc(hidden)]
46-
pub use wit::__link_section;
47-
4841
#[export_name = concat!("spin-sdk-version-", env!("SDK_VERSION"))]
4942
extern "C" fn __spin_sdk_version() {}
5043

0 commit comments

Comments
 (0)