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 ofCopy
things, even when the
array is too large toderive(Clone)
because Rust doesn't implementClone
for arrays of length greater than 32. #874 -
bindgen
can 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_hash
or--with-derive-hash
. #876 -
bindgen
can now generateimpl Debug for Blah
trait implementations for
types that contain non-Debug
types, and therefore cannot
derive(Debug)
. This behavior can be enabled with
bindgen::Builder::impl_debug
and--impl-debug
. #875 -
bindgen
can now invokerustfmt
on the generated bindings. The bindings
have historically been fairly pretty printed, but sometimes this is not the
case, especially with the newimpl Debug for Blah
feature. Havebindgen
runrustfmt
withbindgen::Builder::rustfmt_bindings
and
--rustfmt-bindings
, and use non-defaultrustfmt
configuration files with
bindgen::Builder::rustfmt_configuration_file
and
--rustfmt-configuration-file
. #900 -
bindgen
can 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_partialeq
or
--with-derive-partialeq
. #878 -
Additionally,
bindgen
can 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_eq
or
--with-derive-eq
. #880
Changed
-
Started emitting Rust
union
s 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
Copy
or 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-rust
is deprecated, in favor of
targeting explicit Rust versions with
bindgen::Builder::rust_target
/--rust-target
instead. #832
Fixed
-
Fixed a regression in the
derive(Default)
analysis that resulted in some
opaque types derivingDefault
when 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.