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
Although the js_test does not return a Future, but a plain old Result. The async seems to be totally ignored.
The documentation does not mention my use case, so maybe it is not supported.
Expected Behavior
I would expect one of these, in order of preference:
The JS Promise is automatically converted into a Rust Future with a hidden call to wasm_bindgen_futures::JsFuture::from(), and the return Ok type is automatically converted if different of JsValue.
The compiler complaints that this usage of async is not supported, (yet?).
Actual Behavior
The code compiles but the async keyword is ignored.
The text was updated successfully, but these errors were encountered:
Thanks for the report! It's definitely a bug that this doesn't work right now (or at least isn't an error). That being said I think it'd be super slick if this worked natively and returned an impl Future<...>, that'd be an awesome feature to support!
Describe the Bug
In version 0.2.55, to use a JS async function in Rust I would write:
Because writing
async
directly inside theextern "C"
block was a parse error.But now in 0.2.62 the following compiles fine:
Although the
js_test
does not return aFuture
, but a plain oldResult
. Theasync
seems to be totally ignored.The documentation does not mention my use case, so maybe it is not supported.
Expected Behavior
I would expect one of these, in order of preference:
Promise
is automatically converted into a RustFuture
with a hidden call towasm_bindgen_futures::JsFuture::from()
, and the returnOk
type is automatically converted if different ofJsValue
.async
is not supported, (yet?).Actual Behavior
The code compiles but the
async
keyword is ignored.The text was updated successfully, but these errors were encountered: