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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt out of Send for wasm only #159

Closed
ctaggart opened this issue Apr 14, 2021 · 1 comment
Closed

opt out of Send for wasm only #159

ctaggart opened this issue Apr 14, 2021 · 1 comment

Comments

@ctaggart
Copy link

Hi @dtolnay 馃憢馃徎 ,

I am trying to build Azure/azure-sdk-for-rust#228 for wasm, but I ran into a problem where wasm should not have the Send markers. This does not work, but what I roughly want to do is:

cfg_if::cfg_if! {
    if cfg(target_arch = "wasm32") {
        #[async_trait(?Send)]
    } else {
        #[async_trait]
    }
}

Any suggestions on how to solve this predicament?

@taiki-e
Copy link
Contributor

taiki-e commented Apr 14, 2021

I think cfg_attr would work. Something like the following:

#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]

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

No branches or pull requests

2 participants