I am new to wit bindgen and trying to get my feet wet. I have created my own .wit file and trying to use the wit-bindgen command line to generate rust bindings. But I am afraid I don't know what I need to supply with the --with flag. I basically want to do wit-bindgen rust hello.wit. But it says I absolutely need to provide --with flag. How can I get around this? Thanks in advance.
Phantom said:
I am new to wit bindgen and trying to get my feet wet. I have created my own .wit file and trying to use the wit-bindgen command line to generate rust bindings. But I am afraid I don't know what I need to supply with the --with flag. I basically want to do wit-bindgen rust hello.wit. But it says I absolutely need to provide --with flag. How can I get around this? Thanks in advance.
I would recommend to use the github version of wit-bindgen as the with argument became optional again. Otherwise just provide your interface =generate
to --with
. I never figured out the syntax for multiple interfaces, though.
Christof Petig said:
Phantom said:
I am new to wit bindgen and trying to get my feet wet. I have created my own .wit file and trying to use the wit-bindgen command line to generate rust bindings. But I am afraid I don't know what I need to supply with the --with flag. I basically want to do wit-bindgen rust hello.wit. But it says I absolutely need to provide --with flag. How can I get around this? Thanks in advance.
I would recommend to use the github version of wit-bindgen as the with argument became optional again. Otherwise just provide your interface
=generate
to--with
. I never figured out the syntax for multiple interfaces, though.
Thanks for the response. So I built the wit-bindgen crate and used the binary under target. But looks like the --with is mandatory. I tried ./wit-bindgen rust --with generate= myinterface mywasm.wit.
It complains about my usage of the --with flag. What am I doing wrong?
Yesterday's wit-bindgen release should also work. The with syntax is package:sub/interface=generate
but I am still surprised that it isn't optional: https://github.com/bytecodealliance/wit-bindgen/pull/999
With Rust code if possible it's recommended to use the wit_bindgen::generate!
macro as a crate dependencey, but otherwise yes there were some problems with the release-before-last of wit-bindgen
-the-CLI which should be improved now. The CLI should recommend extra flags you need to pass. You might be interested in the --generate-all
CLI flag.
Alex Crichton said:
With Rust code if possible it's recommended to use the
wit_bindgen::generate!
macro as a crate dependencey, but otherwise yes there were some problems with the release-before-last ofwit-bindgen
-the-CLI which should be improved now. The CLI should recommend extra flags you need to pass. You might be interested in the--generate-all
CLI flag.
Thanks. The latest pull works with --generate-all.
Last updated: Dec 23 2024 at 12:05 UTC