From 0a7a92268181a71a413c248ff66f19003a625b22 Mon Sep 17 00:00:00 2001 From: toyboot4e Date: Sun, 15 Nov 2020 21:21:15 +0900 Subject: [PATCH] bindgen: enable derive_default bindgen option of rustified_enum or newtype_enum are NOT enabled: * newtype_enum: They can't be created from u32, so we can't make our fancy enums with rustic case. * rusitified_enum: They're dangerous if we try to match them: https://github.com/rust-lang/rust/issues/36927 * default: Enum variants are defined as constants. To get strictly typed, we need to wrap them into an `enum`. FFI (fields and functions) will be weakly typed --- rokol_ffi/build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rokol_ffi/build.rs b/rokol_ffi/build.rs index 7f558d5..81d0a2b 100644 --- a/rokol_ffi/build.rs +++ b/rokol_ffi/build.rs @@ -104,6 +104,7 @@ fn make_sokol(wrapper: &str, ffi_file: &str) { let b = b.header(&wrapper); let b = b.clang_arg(format!("-I{}", sokol_dir.display())); // let b = renderer.set_bindgen_flag(b); + let b = b.derive_default(true); b.generate().unwrap() };