Enable bindgen binary module.

* With only minimal features: clap,runtime,which-rustfmt
  to be used as a genrule tool.

Bug: 152884384
Test: make
Change-Id: I826f98105dd84238aa5134cf0614c386ace76201
1 file changed
tree: fcd05f41b4a0a411eadfb1bd629b7548243cf24e
  1. .cargo_vcs_info.json
  2. Android.bp
  3. Cargo.lock
  4. Cargo.toml
  5. Cargo.toml.orig
  6. LICENSE
  7. METADATA
  8. MODULE_LICENSE_BSD_LIKE
  9. OWNERS
  10. README.md
  11. build.rs
  12. csmith-fuzzing/
  13. out/
  14. src/
README.md

crates.io docs.rs

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 */

#[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);
}

Users Guide

📚 Read the bindgen users guide here! 📚

MSRV

The minimum supported Rust version is 1.34.

No MSRV bump policy has been established yet, so MSRV may increase in any release.

API Reference

API reference documentation is on docs.rs

Contributing

See CONTRIBUTING.md for hacking on bindgen!