gecko-dev/third_party/rust/bindgen
Servo VCS Sync fcd2579334 No bug - Revendor rust dependencies 2017-05-10 21:23:02 +00:00
..
.github Bug 1341102: Revendor rust dependencies on a CLOSED TREE. r=red 2017-05-08 21:05:42 +02:00
book Bug 1341102: Revendor rust dependencies on a CLOSED TREE. r=red 2017-05-08 21:05:42 +02:00
ci Bug 1341102: Revendor rust dependencies on a CLOSED TREE. r=red 2017-05-08 21:05:42 +02:00
src No bug - Revendor rust dependencies 2017-05-10 21:23:02 +00:00
.cargo-checksum.json No bug - Revendor rust dependencies 2017-05-10 21:23:02 +00:00
.cargo-ok
.gitignore
.travis.yml Bug 1341102: Revendor rust dependencies on a CLOSED TREE. r=red 2017-05-08 21:05:42 +02:00
CONTRIBUTING.md Bug 1341102: Revendor rust dependencies on a CLOSED TREE. r=red 2017-05-08 21:05:42 +02:00
Cargo.toml No bug - Revendor rust dependencies 2017-05-10 21:23:02 +00:00
LICENSE
README.md Bug 1341102: Revendor rust dependencies on a CLOSED TREE. r=red 2017-05-08 21:05:42 +02:00
build.rs Bug 1341102: Revendor rust dependencies on a CLOSED TREE. r=red 2017-05-08 21:05:42 +02:00
example-graphviz-ir.png Bug 1341102: Revendor rust dependencies on a CLOSED TREE. r=red 2017-05-08 21:05:42 +02:00
rustfmt.toml

README.md

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!