-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow async traits #2409
Comments
Thanks for the report! I believe the issue here is the Send/Sync bounds automatically added with |
It's magic! Using
on both the trait and the implementation makes this work! Of course, RTFM would have helped here... https://github.com/dtolnay/async-trait/blame/master/README.md#L134 Thanks a lot! Up to new adventures I go. |
I'm trying to make the
@alexcrichton, could you please elaborate on why:
I have a hunch, but just seeing if there is a fundamental incompatibility. Thank you. |
Futures generated with wasm-bindgen aren't |
Motivation
I would like to use traits to write common code that can be used for wasm and i586 binaries. Part of the code should interact with the network. So I'd like to define a network trait that can be implemented for the wasm part and the i586 part.
Proposed Solution
A simple use-case would be the following:
Alternatives
I tried to come up with alternatives that don't include the
async
-trait, but couldn't make it work. Any proposition is welcome ;)Additional Context
It should be possible to implement the trait for rest-requests and webrtc requests. The above code complains with
The text was updated successfully, but these errors were encountered: