tag | 0aac34ffbe6dc4363bda624fb870ce1db614b9af | |
---|---|---|
tagger | Emilio Cobos Álvarez <emilio@crisal.io> | Tue May 09 00:24:57 2017 +0200 |
object | 31e440917cdc8ac57cd69ddf929e90a7c4b46367 |
v0.25.0
commit | 31e440917cdc8ac57cd69ddf929e90a7c4b46367 | [log] [tgz] |
---|---|---|
author | Emilio Cobos Álvarez <emilio@crisal.io> | Mon May 08 23:41:32 2017 +0200 |
committer | Emilio Cobos Álvarez <emilio@crisal.io> | Mon May 08 23:45:26 2017 +0200 |
tree | bec52d4264d736917634dad523c780ffedfcee34 | |
parent | 2d88dd106bf33807679f531051546f3c9889161e [diff] |
codegen: Make phantom fields public. Otherwise you can't construct structs outside of the bindings file, which is breaking. Also, given the previous change was breaking and I didn't notice, I yanked 0.24.1.
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); }
📚 Read the bindgen
users guide here! 📚
API reference documentation is on docs.rs