From ff3eb24aceb6840f548fb583146bb09e8a69b5a0 Mon Sep 17 00:00:00 2001 From: cgmossa Date: Thu, 16 Nov 2023 15:53:05 +0100 Subject: [PATCH] Make C-enums into idiomatic rust enums --- build.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.rs b/build.rs index 768c4d56..4043f401 100644 --- a/build.rs +++ b/build.rs @@ -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);