Skip to content

Implement support for exported resources in bindgen!#7050

Merged
alexcrichton merged 2 commits into
bytecodealliance:mainfrom
alexcrichton:exported-resources
Sep 15, 2023
Merged

Implement support for exported resources in bindgen!#7050
alexcrichton merged 2 commits into
bytecodealliance:mainfrom
alexcrichton:exported-resources

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This commit updates the wasmtime::component::bindgen! to support exported resources. Exported resources are themselves always modeled as ResourceAny at runtime and are required to perform dynamic type checks to ensure that the right type of resource is passed in. Exported resources have their own GuestXXX structure exported to namespace all of their methods. Otherwise, like imports, there's not a whole lot of special treatment of exported resources.

This commit updates the `wasmtime::component::bindgen!` to support
exported resources. Exported resources are themselves always modeled as
`ResourceAny` at runtime and are required to perform dynamic type checks
to ensure that the right type of resource is passed in. Exported
resources have their own `GuestXXX` structure exported to namespace all
of their methods. Otherwise, like imports, there's not a whole lot of
special treatment of exported resources.
@alexcrichton alexcrichton requested a review from a team as a code owner September 15, 2023 20:03
@alexcrichton alexcrichton requested review from pchickey and removed request for a team September 15, 2023 20:03
Looks like `to_snake_case` behaves differently if the `unicode` feature
is enabled or not so bypass that entirely.
@alexcrichton alexcrichton added this pull request to the merge queue Sep 15, 2023
Merged via the queue into bytecodealliance:main with commit 2ad057d Sep 15, 2023
@alexcrichton alexcrichton deleted the exported-resources branch September 15, 2023 22:24
eduardomourar pushed a commit to eduardomourar/wasmtime that referenced this pull request Sep 22, 2023
…nce#7050)

* Implement support for exported resources in `bindgen!`

This commit updates the `wasmtime::component::bindgen!` to support
exported resources. Exported resources are themselves always modeled as
`ResourceAny` at runtime and are required to perform dynamic type checks
to ensure that the right type of resource is passed in. Exported
resources have their own `GuestXXX` structure exported to namespace all
of their methods. Otherwise, like imports, there's not a whole lot of
special treatment of exported resources.

* Work around `heck` issue

Looks like `to_snake_case` behaves differently if the `unicode` feature
is enabled or not so bypass that entirely.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants