Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement support for exported resources in bindgen! #7050

Merged
merged 2 commits into from
Sep 15, 2023

Conversation

alexcrichton
Copy link
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
18 checks passed
@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