Stream: cargo-component

Topic: bindgen


view this post on Zulip Sehz (Jan 30 2024 at 00:43):

Hi, Is there way to customize how cargo component generates bindings similar to wit-bindgen?

view this post on Zulip Peter Huene (Jan 30 2024 at 01:40):

Yes, there are (undocumented except for code :pensive:) settings one can add to package.metadata.component.bindings in Cargo.toml

view this post on Zulip Peter Huene (Jan 30 2024 at 01:40):

I'm away from a computer at the moment, but I can pull up the settings shortly

view this post on Zulip Peter Huene (Jan 30 2024 at 02:41):

The relevant settings: https://github.com/bytecodealliance/cargo-component/blob/main/src/metadata.rs#L62-L75

view this post on Zulip Sehz (Jan 30 2024 at 02:53):

Thanks. Will see if this is sufficient

view this post on Zulip Sehz (Jan 30 2024 at 05:35):

Neither wit-bidden and cargo component doesn't support remapping of interfaces. File issue: https://github.com/bytecodealliance/cargo-component/issues/225. It's bit frustrating that there are 3 different bindgen implementations

Implement same capability bytecodealliance/wit-bindgen#825.

view this post on Zulip Youn Mélois (Apr 17 2024 at 15:05):

Peter Huene said:

The relevant settings: https://github.com/bytecodealliance/cargo-component/blob/main/src/metadata.rs#L62-L75

Hi, seems like cargo-component doesn't support all settings of wit-bindgen: https://github.com/bytecodealliance/wit-bindgen/blob/90a1e547e1a4515a5769f5d157ffc519c5d851a3/crates/rust/src/lib.rs#L87-L189
Is it planned to add support to them?

A language binding generator for WebAssembly interface types - bytecodealliance/wit-bindgen

view this post on Zulip Peter Huene (Apr 17 2024 at 18:18):

There's an issue to support with, but beyond that there hasn't been asks for other configuration options to be supported; if you have a particular need for one, I would suggest filing an issue or opening a PR

view this post on Zulip Youn Mélois (Apr 17 2024 at 18:25):

I opened a PR to add support for all the missing settings but I don't know if it's relevant to add them all since as you said other configuration options have not been requested to be supported. https://github.com/bytecodealliance/cargo-component/pull/273

This adds support for the missing settings from wit-bindgen. It is now a 1 to 1 copy of Opts fields (but with) from wit-bindgen-rust although not similarly sorted. (https://github.com/bytecodeallia...

view this post on Zulip Peter Huene (Apr 17 2024 at 18:36):

Thanks for putting up the PR!


Last updated: Nov 25 2024 at 19:03 UTC