Add only_interfaces and with to the bindgen! macro.#6160
Merged
elliottt merged 4 commits intobytecodealliance:mainfrom Apr 11, 2023
Merged
Add only_interfaces and with to the bindgen! macro.#6160elliottt merged 4 commits intobytecodealliance:mainfrom
only_interfaces and with to the bindgen! macro.#6160elliottt merged 4 commits intobytecodealliance:mainfrom
Conversation
alexcrichton
approved these changes
Apr 10, 2023
Member
alexcrichton
left a comment
There was a problem hiding this comment.
Seems reasonable to me! Can you add some updated docs to crates/wasmtime/src/component.rs as well which should have a big doc-block on the reexport of the bindgen! macro for this.
f62bffc to
d4a2e09
Compare
brendandburns
pushed a commit
to brendandburns/wasmtime
that referenced
this pull request
Apr 13, 2023
…liance#6160) * Add `only_interfaces` and `with` to the `bindgen!` macro. * Add a version of the empty_error test for `only_interfaces` and `with` * Review feedback * Add docs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the
only_interfacesandwithoptions to thebindgen!macro. These two additional options enable the definitions of a use ofbindgen!to be split up and reused in the following way:only_interfaces: trueto an invocation ofbindgen!will cause only the interfaces depended on by the supplied world to be generated, allowing the interface definitions depended on by two world files to be shared.with: { "a": module::name }allows references to theaimport to be remapped to a known module, in this casemodule::name. When this option is supplied, no code will be generated for the interfacea, assuming that those definitions came from a previous use ofbindgen!withonly_interfaces: true.Here's a use in the
preview2-prototypingrepository for a motivating example of how this can be used with thecommandworld.