commit | abba57c6f00ce2bb11273734aed0054997c92fcb | [log] [tgz] |
---|---|---|
author | android-build-team Robot <[email protected]> | Sun Feb 21 02:44:11 2021 +0000 |
committer | Automerger Merge Worker <[email protected]> | Sun Feb 21 02:44:11 2021 +0000 |
tree | 3717592d18875610cf91d5e2ea2967b70187337c | |
parent | a5fb1753010deef27b169b8639119ee489ab92d6 [diff] | |
parent | 52fe3fc0851bd358086cde6c6ff75d82df672b9a [diff] |
Snap for 7160059 from 29e516251df4507bb5a8078c0b0d0b85914eb259 to sc-release am: 52fe3fc085 Original change: https://googleplex-android-review.googlesource.com/c/platform/external/rust/crates/bindgen/+/13646349 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I60cb10b145bf1fedd3aa3f8049b17d7aadfcb356
bindgen
bindgen
automatically generates Rust FFI bindings to C (and some C++) libraries.
For example, given the C header doggo.h
:
typedef struct Doggo { int many; char wow; } Doggo; void eleven_out_of_ten_majestic_af(Doggo* pupper);
bindgen
produces Rust FFI code allowing you to call into the doggo
library's functions and use its types:
/* automatically generated by rust-bindgen 0.99.9 */ #[repr(C)] pub struct Doggo { pub many: ::std::os::raw::c_int, pub wow: ::std::os::raw::c_char, } extern "C" { pub fn eleven_out_of_ten_majestic_af(pupper: *mut Doggo); }
📚 Read the bindgen
users guide here! 📚
The minimum supported Rust version is 1.40.
No MSRV bump policy has been established yet, so MSRV may increase in any release.
API reference documentation is on docs.rs
In addition to the library API and executable command-line API, bindgen
can be controlled through environment variables.
End-users should set these environment variables to modify bindgen
's behavior without modifying the source code of direct consumers of bindgen
.
BINDGEN_EXTRA_CLANG_ARGS
: extra arguments to pass to clang
--sysroot=/path/to/sysroot
-I"/path/with spaces"
Additionally, bindgen
uses libclang
to parse C and C++ header files. To modify how bindgen
searches for libclang
, see the clang-sys
documentation. For more details on how bindgen
uses libclang
, see the bindgen
users guide.
We don't follow a specific release calendar, but if you need a release please file an issue requesting that (ping @emilio
for increased effectiveness).