windows-rs
windows-rs copied to clipboard
bindgen: offer a type-safe Rust API
Suggestion
This is the main API entry point in the windows-bindgen crate today:
pub fn bindgen<I, S>(args: I) -> Warningswhere
I: IntoIterator<Item = S>,
S: AsRef<str>;
You then have to pass what amounts to CLI arguments into this function. While I can understand that this is/has been expedient, it would be nice to offer an idiomatic type-safe Rust API instead. I think a builder-like API could work quite well and still allow substantial evolution without semver-incompatible bumps.
Something like:
windows_bindgen::builder()
.output(Path::from("src/bindings.rs"))
.modules(false)
.style(Style::Sys)
.comment(false)
.generate()
Happy to help review such an API.
Good idea - originally this was a command line tool but a library was more convenient for most scenarios.