Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why are futures generated by wasm_bindgen not Send? #2833

Open
jplatte opened this issue Mar 9, 2022 · 3 comments
Open

Why are futures generated by wasm_bindgen not Send? #2833

jplatte opened this issue Mar 9, 2022 · 3 comments
Labels

Comments

@jplatte
Copy link
Contributor

jplatte commented Mar 9, 2022

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.

@alexcrichton
Copy link
Contributor

Anything related to JsValue is not-Send in WebAssembly, which is probably where this comes from.

@jplatte
Copy link
Contributor Author

jplatte commented Mar 9, 2022

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)?

@alexcrichton
Copy link
Contributor

Yes because of web workers it matters, and at this time I don't know of anything that can be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants