--generate-stub for Rust
Does anything speak against adding a --generate-stub flag for Rust, like the one for CSharp?
> wit-bindgen csharp --help | grep stub
--generate-stub
Whether or not to generate a stub class for exported functions
If not, I may consider contributing a PR for this.
Does the --stubs flag work for you?
The problem with --stubs is that the stub gets embedded within the bindings file. What I'm looking for is something like a separate lib.rs file containing just the stub. A file that can be manually edited, and that won't get overwritten when re-running wit-bindgen (unless perhaps the --generate-stub flag is set again)
However, as the rust command already has the --stubs flag, adding another --generate-stubs doesn't feel ideal. Perhaps adding an optional value to --stubs that can be either embedded or separate, defaulting to the former if we want to maintain backwards compatibility?
The reason I wanted this no longer applies, as I already have a WIT generator and decided to just add a flag to also generate the stubs. However, if there’s interest in such a feature for wit-bindgen, I may take a stab at it.
Ah ok makes sense, and yeah I think it'd be reasonable to add support for this and generating into a separate file
I've created a draft PR with a couple of discussion points: #1354