Open
Description
Describe the Bug
Currently #[wasm_bindgen]
on async fn
seems to only accept types that are Into<JsValue>
, but many wasm-bindgen types are only IntoWasmAbi
, making it hard to convert synchronous code into asynchronous.
Steps to Reproduce
Try to compile code like following:
use wasm_bindgen::Clamped;
#[wasm_bindgen]
pub fn foo() -> Clamped<Vec<u8>> {
Clamped(vec![])
}
#[wasm_bindgen]
pub async fn foo() -> Clamped<Vec<u8>> {
Clamped(vec![])
}
Expected Behavior
Both functions compile successfully and generate their bindings.
Actual Behavior
Second function fails to compile due to:
| #[wasm_bindgen]
| ^^^^^^^^^^^^^^^ the trait `From<Clamped<Vec<u8>>>` is not implemented for `JsValue`