Skip to content

Commit

Permalink
bindgen: enable derive_default
Browse files Browse the repository at this point in the history
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: rust-lang/rust#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
  • Loading branch information
toyboot4e committed Nov 15, 2020
1 parent 0abd13e commit 0a7a922
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions rokol_ffi/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};

Expand Down

0 comments on commit 0a7a922

Please sign in to comment.