Skip to content

Documentation: "Supported Types" pages should be clear about whether they're about JS -> rust or also about rust -> JS #1667

Open
@mstange

Description

@mstange

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:

  1. 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.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsIssues related to documentationhelp wantedWe could use some help fixing this issue!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions