You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Activity
alexcrichton commentedon Aug 12, 2025
Does the
--stubsflag work for you?EugenDueck commentedon Aug 12, 2025
The problem with
--stubsis 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-runningwit-bindgen(unless perhaps the--generate-stubflag is set again)EugenDueck commentedon Aug 12, 2025
However, as the
rustcommand already has the--stubsflag, adding another--generate-stubsdoesn't feel ideal. Perhaps adding an optional value to--stubsthat can be eitherembeddedorseparate, defaulting to the former if we want to maintain backwards compatibility?EugenDueck commentedon Aug 13, 2025
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.
alexcrichton commentedon Aug 13, 2025
Ah ok makes sense, and yeah I think it'd be reasonable to add support for this and generating into a separate file
EugenDueck commentedon Aug 15, 2025
I've created a draft PR with a couple of discussion points: #1354