commit | 6f313ab1a91cdf7b8c1d0e7c7e89f5f60bcb79da | [log] [tgz] |
---|---|---|
author | Chih-Hung Hsieh <chh@google.com> | Thu Aug 27 21:50:33 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Aug 27 21:50:33 2020 +0000 |
tree | e83fa9121057b2c89d0a527c85a5d329a759387a | |
parent | 304d8741b462dc5547d95a6ec3c6590b7a92022d [diff] | |
parent | d6c9ccd0a23dc2b88fc2333346fc41d13521f47e [diff] |
Fix bindgen/METADATA am: d6c9ccd0a2 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/bindgen/+/1414002 Change-Id: Ifd2924cb94d4dc70148b1fa7696e13059692eab7
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.