wasm-bindgen
wasm-bindgen copied to clipboard
Why are futures generated by wasm_bindgen not `Send`?
Summary
Why are futures generated with wasm-bindgen not Send? Is there a way to opt into Sendness? Currently, if one wants to use async-trait for wasm, one has to do this very ugly thing on trait and impl:
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
Additional Details
This came up before in #2409, but I didn't want to bump an old closed issue.
Anything related to JsValue is not-Send in WebAssembly, which is probably where this comes from.
Is there anything that you can think of that could be done about that? Does Send even mean much of anything for wasm, browser targets in particular (maybe yes bc. of web workers)?
Yes because of web workers it matters, and at this time I don't know of anything that can be done.