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
error: symbol `scanner_isRecognized` is already defined
--> src/lib.rs:8:1
|
8 | #[wasm_bindgen(js_class = Scanner)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `wasm_bindgen::prelude::__wasm_bindgen_class_marker` (in Nightly builds, run with -Z macro-backtrace for more info)
If any one of the the #[wasm_bindgen(js_name = isRecognized)] names are changed the error does not appear. For symmetry with using polymorphic JS functions, it would be very nice to have this work. This question is somewhat related to #1139 but the case here is a bit simpler, I believe.
Is there a way to make this work? Alternatively, is there any workaround?
Thank you for any input on this!
The text was updated successfully, but these errors were encountered:
You could just take JsValues as arguments and figure out which type it is at runtime, but otherwise this isn't supported.
I'm going to close this in favor of #1339, while it is true that this proposal is a bit simpler, the implementation would be the same and its just API design at this point.
Summary
The documentation explains very well how to use polymorphic, i.e., overloaded, JavaScript functions in Rust with js_name.
Is a way to do it the other way around too and make multiple Rust functions available to JS under the same name but with different arguments?
Additional Details
Here is minimalistic example that fails to compile.
The error is:
If any one of the the
#[wasm_bindgen(js_name = isRecognized)]
names are changed the error does not appear. For symmetry with using polymorphic JS functions, it would be very nice to have this work. This question is somewhat related to #1139 but the case here is a bit simpler, I believe.Is there a way to make this work? Alternatively, is there any workaround?
Thank you for any input on this!
The text was updated successfully, but these errors were encountered: