Skip to content

Commit

Permalink
Make C-enums into idiomatic rust enums
Browse files Browse the repository at this point in the history
  • Loading branch information
CGMossa committed Apr 20, 2024
1 parent 6883db3 commit ff3eb24
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,11 @@ fn generate_bindings(r_paths: &InstallationPaths, version_info: &RVersionInfo) {
// Tell cargo to invalidate the built crate whenever any of the
// included header files changed.
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()));

// Collect C-enums into idiomatic Rust-style enums
bindgen_builder = bindgen_builder.default_enum_style(bindgen::EnumVariation::Rust {
non_exhaustive: false,
});

if cfg!(feature = "layout_tests") {
bindgen_builder = bindgen_builder.layout_tests(true);
Expand Down

0 comments on commit ff3eb24

Please sign in to comment.