You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Was getting some unexpected behavior when working with extern "C" in combination with async.
#[wasm_bindgen]extern"C"{asyncfnf() -> String;}
This does not compile.
mismatched types
expected struct `std::string::String`, found struct `wasm_bindgen::JsValue`
Currently it seems like we cannot have return type different than JsValue. (Implementing From<JsValue> doesn't help.) However, there appears to be no information on this in the official documentation.
After some searching, I found some background info on this in the PR implementing the functionality: #2196 (comment). Basically it seems that only return types JsValue is supported.
Proposed Solution
Add relevant information about allowed return types in async extern C to official documentation.
(Might create a PR for this myself if I find time, but wanted to document here now.)
The text was updated successfully, but these errors were encountered:
Motivation
Was getting some unexpected behavior when working with
extern "C"
in combination withasync
.This does not compile.
Currently it seems like we cannot have return type different than
JsValue
. (ImplementingFrom<JsValue>
doesn't help.) However, there appears to be no information on this in the official documentation.After some searching, I found some background info on this in the PR implementing the functionality: #2196 (comment). Basically it seems that only return types
JsValue
is supported.Proposed Solution
Add relevant information about allowed return types in async extern C to official documentation.
(Might create a PR for this myself if I find time, but wanted to document here now.)
The text was updated successfully, but these errors were encountered: