-
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
Returning Vec<String>
from an async function fails to compile
#3793
Comments
same here |
There is a way around this, but it is ugly. If you define a newtype for Vec: pub struct VecString(Vec<String>); Then you can impl From for VecString. impl From<VecString> for JsValue {
fn from(value: VecString) -> Self {
serde_wasm_bindgen::to_value(&value).unwrap()
}
} You will need serde_wasm_bindgen. |
Here is a better solution #3630 [patch.crates-io]
wasm-bindgen = { git = "https://github.com/rustwasm/wasm-bindgen", rev = "88efe46" } This will use the wasm-bindgen version that includes the commit that supports Vec for async functions |
Considering #3630 has already been merged, I'm gonna go ahead and close this. |
Describe the Bug
This code:
Expected Behavior
Should compile,
Actual Behavior
But gives the following compilation error:
Additional Context
wasm-bindgen = "0.2"
The text was updated successfully, but these errors were encountered: