diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-07-14 04:53:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-14 04:53:10 -0700 |
commit | 5366a05f593ecbc9ecdda32ac2907d1dbd739b1e (patch) | |
tree | 78877ff90e50dbb0089d6c0cbf1ff6c73aa7ed09 | |
parent | f0b343235fe14bcf24dd9ad852c0cbd7eaaefcd0 (diff) | |
parent | cfdcda6f9132e4ab112f49d00a1a834ce9c05644 (diff) |
Auto merge of #813 - fitzgen:we-need-lots-more-fun-around-here, r=emilio
11/10 MAJESTIC AF
r? @emilio
-rw-r--r-- | README.md | 24 |
1 files changed, 11 insertions, 13 deletions
@@ -2,33 +2,31 @@ **`bindgen` automatically generates Rust FFI bindings to C and C++ libraries.** -For example, given the C header `cool.h`: +For example, given the C header `doggo.h`: ```c -typedef struct CoolStruct { - int x; - int y; -} CoolStruct; +typedef struct Doggo { + int many; + char wow; +} Doggo; -void cool_function(int i, char c, CoolStruct* cs); +void eleven_out_of_ten_majestic_af(Doggo* pupper); ``` -`bindgen` produces Rust FFI code allowing you to call into the `cool` library's +`bindgen` produces Rust FFI code allowing you to call into the `doggo` library's functions and use its types: ```rust /* automatically generated by rust-bindgen */ #[repr(C)] -pub struct CoolStruct { - pub x: ::std::os::raw::c_int, - pub y: ::std::os::raw::c_int, +pub struct Doggo { + pub many: ::std::os::raw::c_int, + pub wow: ::std::os::raw::c_char, } extern "C" { - pub fn cool_function(i: ::std::os::raw::c_int, - c: ::std::os::raw::c_char, - cs: *mut CoolStruct); + pub fn eleven_out_of_ten_majestic_af(pupper: *mut Doggo); } ``` |