gecko-dev/third_party/rust/bindgen
Kartikaya Gupta 47c3dd535d Bug 1369156 - Re-vendor third-party rust libraries with latest cargo-vendor. r=froydnj
MozReview-Commit-ID: LQicTh0fmk0

--HG--
extra : rebase_source : 7a5ee9c3242fefa72e8d0372b8e9c03170c7df4b
2017-06-20 16:05:17 -04:00
..
.github No bug - Revendor rust dependencies 2017-05-21 06:13:11 +00:00
book Bug 1369156 - Re-vendor third-party rust libraries with latest cargo-vendor. r=froydnj 2017-06-20 16:05:17 -04:00
ci No bug - Revendor rust dependencies 2017-05-21 06:13:11 +00:00
src No bug - Revendor rust dependencies 2017-06-15 19:37:16 +00:00
.cargo-checksum.json Bug 1369156 - Re-vendor third-party rust libraries with latest cargo-vendor. r=froydnj 2017-06-20 16:05:17 -04:00
.cargo-ok
.travis.yml No bug - Revendor rust dependencies 2017-05-30 19:18:04 +00:00
build.rs No bug - Revendor rust dependencies 2017-06-14 23:57:02 +00:00
Cargo.toml No bug - Revendor rust dependencies 2017-06-15 19:37:16 +00:00
CONTRIBUTING.md No bug - Revendor rust dependencies 2017-05-30 19:18:04 +00:00
example-graphviz-ir.png Bug 1341102: Revendor rust dependencies on a CLOSED TREE. r=red 2017-05-08 21:05:42 +02:00
LICENSE
README.md Bug 1341102: Revendor rust dependencies on a CLOSED TREE. r=red 2017-05-08 21:05:42 +02:00
rustfmt.toml

bindgen

bindgen automatically generates Rust FFI bindings to C and C++ libraries.

For example, given the C header cool.h:

typedef struct CoolStruct {
    int x;
    int y;
} CoolStruct;

void cool_function(int i, char c, CoolStruct* cs);

bindgen produces Rust FFI code allowing you to call into the cool library's functions and use its types:

/* automatically generated by rust-bindgen */

#[repr(C)]
pub struct CoolStruct {
    pub x: ::std::os::raw::c_int,
    pub y: ::std::os::raw::c_int,
}

extern "C" {
    pub fn cool_function(i: ::std::os::raw::c_int,
                         c: ::std::os::raw::c_char,
                         cs: *mut CoolStruct);
}

Users Guide

📚 Read the bindgen users guide here! 📚

API Reference

API reference documentation is on docs.rs

Contributing

See CONTRIBUTING.md for hacking on bindgen!