Stream: wit-bindgen

Topic: inspecting generated code


view this post on Zulip Christoph Brewing (Apr 14 2023 at 13:28):

Can I somehow make visible what wit-bindgen generates? If yes, how?

view this post on Zulip Lann Martin (Apr 14 2023 at 13:37):

There are multiple ways to invoke wit-bindgen. Are you referring to the Rust macro? If so, the most straightforward way is probably https://github.com/dtolnay/cargo-expand

Subcommand to show result of macro expansion. Contribute to dtolnay/cargo-expand development by creating an account on GitHub.

view this post on Zulip Lann Martin (Apr 14 2023 at 13:41):

If you happen to be using vscode with the rust-analyzer extension you can put the cursor on the macro invocation and run the command "rust-analyzer: Expand macro recursively"

view this post on Zulip Christoph Brewing (Apr 14 2023 at 13:45):

that works, thank you!

view this post on Zulip Peter Huene (Apr 14 2023 at 17:54):

Also, if you're using cargo-component, you can find the generated bindings in target/bindings


Last updated: Dec 23 2024 at 13:07 UTC