Announcing bindgen v0.30.0
bindgen automatically generates Rust FFI bindings to C and C++ libraries.
Upgrade to this release by updating your Cargo.toml:
bindgen = "0.30.0"
Changelog
Added
- Explicit control over choosing which Rust version (specific stable versions or
nightly Rust) to target. This defaults to the latest stable Rust version. #832
bindgen::Builder::default()
.rust_target(bindgen::RustTarget::Stable_1_19)
// or `.rust_target(bindgen::RustTarget::Nightly)` to use unstable features
or
$ bindgen --rust-target 1.19
# or `--rust-target nightly` to use unstable features
-
Started adding
derive(Copy)for large arrays ofCopythings, even when the
array is too large toderive(Clone)because Rust doesn't implementClone
for arrays of length greater than 32. #874 -
bindgencan now determine which types are hashable and addderive(Hash)to
those types that support it. This is disabled by default, but can be enabled
viabindgen::Builder::derive_hashor--with-derive-hash. #876 -
bindgencan now generateimpl Debug for Blahtrait implementations for
types that contain non-Debugtypes, and therefore cannot
derive(Debug). This behavior can be enabled with
bindgen::Builder::impl_debugand--impl-debug. #875 -
bindgencan now invokerustfmton the generated bindings. The bindings
have historically been fairly pretty printed, but sometimes this is not the
case, especially with the newimpl Debug for Blahfeature. Havebindgen
runrustfmtwithbindgen::Builder::rustfmt_bindingsand
--rustfmt-bindings, and use non-defaultrustfmtconfiguration files with
bindgen::Builder::rustfmt_configuration_fileand
--rustfmt-configuration-file. #900 -
bindgencan now determine which types can be compared with==and add
derive(PartialEq)to those types that support it. This is disabled by
default, but can be enabled viabindgen::Builder::derive_partialeqor
--with-derive-partialeq. #878 -
Additionally,
bindgencan also addderive(Eq)to those types which we
determined we couldderive(PartialEq)and do not transitively contain any
floats. Enable this behavior withbindgen::Builder::derive_eqor
--with-derive-eq. #880
Changed
-
Started emitting Rust
unions when targeting stable Rust >= 1.19, not just
unstable nightly Rust. #832 -
Emitted layout
#[test]s no longer contain internal IDs for template
instantiations including pointers and arrays. This should make generated
bindings more stable across updates to unrelated parts of the input
headers. #871 -
Determining whether a type can derive
Copyor not was ported from an ad-hoc
algorithm to our fix-point framework. #766 -
Determining whether a type has a destructor or not was also ported from an
ad-hoc algorithm to our fix-point framework. #927
Deprecated
bindgen::Builder::unstable_rust/--unstable-rustis deprecated, in favor of
targeting explicit Rust versions with
bindgen::Builder::rust_target/--rust-targetinstead. #832
Fixed
-
Fixed a regression in the
derive(Default)analysis that resulted in some
opaque types derivingDefaultwhen they shouldn't have. #889 -
Fixed a regression where template instantiation layout
#[test]s were being
generated with invalid Rust identifiers. #906
Friends
Thanks to everyone who contributed to this release!
- Anna Liao
- Bastian Köcher
- Benjamin Dahse
- Emilio Cobos Álvarez
- Malo Jaffré
- Nick Fitzgerald
- Niv
- Richard Bradfield
- Travis Finkenauer
- Wangshan Lu
- Xidorn Quan
- Zhiting Zhu
Contributing
Want to join us? Check out our CONTRIBUTING.md and take a look
at some of these issues:
- Issues labeled "easy"
- Issues labeled "less easy"
- Still can't find something to work on? Drop a comment here.
Want to help improve our documentation?
Check out the issues labeled "docs".
Found a bug with bindgen? File an issue here.