bindgenbindgen automatically generates Rust FFI bindings to C and C++ libraries.
For example, given the C header cool.h:
```c 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:
```rust /* automatically generated by rust-bindgen */
pub struct CoolStruct { pub x: ::std::os::raw::cint, pub y: ::std::os::raw::cint, }
extern "C" { pub fn coolfunction(i: ::std::os::raw::cint, c: ::std::os::raw::c_char, cs: *mut CoolStruct); } ```
📚 Read the bindgen users guide here! 📚
API reference documentation is on docs.rs