bytecodealliance / bytecodealliance/wasmtime
`bindgen!` creates separate types for imports and exports of an interface
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 121
Description
Originally discussed on Zulip here: https://bytecodealliance.zulipchat.com/#narrow/stream/217126-wasmtime/topic/Sharing.20generated.20code.20between.20same.20interface.20import.2Fexport
It would sometimes be convenient to share the generated types between imports and exports of an interface, e.g. if one component calls the host though a given interface and then the host forwards the call to some other component in an entirely separate instance using the same interface.
This is currently not possible, and so conversion between the structurally-identical but separate types must be done manually. If there is a good reason why the imported and exported WIT types should be generated as separate Rust types, perhaps conversions between them should be generated for when you know that's what you want to do?
**EDIT:** Another use case this would help is extending generated types with extra behavior and sharing that through a crate.
Contributor guide
Assessment
This issue has not been assessed yet.