-
Notifications
You must be signed in to change notification settings - Fork 12
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
wasm32 support? #116
Comments
As far as I can tell,
What fails is |
I've added a CI job in #117 that pins the working |
Thanks for the information. As far as I tried in my local environment, |
* CI: Add a job to check that the `wasm32-wasi` target builds Part of #116. * CI: Run checks against `wasm32-unknown-unknown` as well
If we try to use ATrium in an environment such as Cloudflare Workers (not sure if there is such a use case), it will be built with
--target wasm32-...
.However, the current atrium-api cannot be built with that target. Perhaps we encount the following error.
This is because
async_trait
converts async functions to requiredyn Future + Send
, which seems to cause the build to fail on the wasm32 target.It seems that we can write
#[async_trait(?Send)]
to work around this limitation.https://docs.rs/async-trait/latest/async_trait/#non-threadsafe-futures
Many projects seem to use
target_arch = "wasm32"
to switch whether to add?Send
or not.ATrium seems to be able to solve this problem in the same way.
https://github.com/search?q=%22%2C+async_trait%28%3FSend%29%29%5D%22+language%3ARust&type=code
By the way, if we can change MSRV to 1.75 in the future, we won't need to use
async_trait
, but we will probably usetrait_variant::make
then.https://blog.rust-lang.org/2023/12/21/async-fn-rpit-in-traits.html#async-fn-in-public-traits
The text was updated successfully, but these errors were encountered: