commit | a79b404c9dc08aed6dbe7bf07c20647666e9f65d | [log] [tgz] |
---|---|---|
author | Emilio Cobos Álvarez <emilio@crisal.io> | Mon Jan 22 10:11:21 2018 +0100 |
committer | Emilio Cobos Álvarez <emilio@crisal.io> | Mon Jan 22 10:11:21 2018 +0100 |
tree | 58aa716a127d75f6e00ec2c1fe24df04d80b3ce8 | |
parent | 8fa15cc9b93bffdb93ac05c374eca25157bcf281 [diff] |
codegen: Try to reasonably handle enum : bool. Just use the repr name we generate, since we generate constants for that. It's not worth trying to guess the actual type to use IMO. Bindings lose a bit of portability I guess, but that's really a lost bet already, so instead of special-casing bool and map constants, let's use a consistent representation everywhere. Fixes #1145
bindgen
impl period
has been started! Join us at Gitter.im.
bindgen
automatically generates Rust FFI bindings to C and 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); }
📚 Read the bindgen
users guide here! 📚
API reference documentation is on docs.rs