rust: How to export all structs
Closed this issue · 3 comments
How to make wit_bindgen::generate!
generate all types in world export <<interface>>
?
Dead code elimination is performed by default.
If a record or variant is not an input or return value of any function, such a type will not be generated as rust struct and enum.
Currently there's no option to do this, but if you'd like I think it'd be reasonable to add an option. A PR for this would be most welcome!
I can try to submit a PR, but I don’t know what should be changed
- I am going to add
allow_unused: bool
here
- This seems to be the entrance to the backend, but unused has been deleted before.
wit-bindgen/crates/rust/src/interface.rs
Line 1365 in b4b56c0
I believe the main thing you'll want to change is this line where you'll want to consult self.gen.opts.<your-option-here>
. That'd then be plumbed through the macro in the enum Opt
you found as well.