Description
This issue is about the sub pages of the "2.14 Supported Types" section in the documentation.
These pages all have a table with various "parameter" and "return value" columns, and then some example code at the end. The example code only contain JS -> rust calls. This led me to assume that the "parameter" and "return value" columns also only describe parameters and return values of #[wasm_bindgen]
-exported rust functions that are called from JS.
However, based on the conversation in #1659, I'm starting to believe that maybe these pages are also meant to describe rust -> JS calls? For example, if the table at the top says Yes for one of the "parameter" columns, does this also mean that I can pass something of this type in my rust code to an imported JS function which I declared in a #[wasm_bindgen] extern "C"
block?
If rust -> JS calls are part of the intended meaning of this documentation, I have the following requests:
- Please add some explanation to the table at the top so that it becomes clear which types of functions the "parameter" and "return value" columns apply to: exported rust functions, imported JS functions, or both.
- Please add example code that shows the other direction.
It may also be necessary to give the tables two rows, one for exported rust functions and one for imported JS functions, in case the supported types differ. For example, I'm pretty sure they differ for exported struct Whatever
rust types: I can pass a &Whatever
parameter from JS to rust but it looks like it's not possible to pass one from rust to JS at the moment.