Rust bindgen
rust bindgen is a code-generation tool that generates Rust foreign-function interface bindings from C and C++ declarations.
Refactoring to Rust
bindgen is a code-generation tool that creates language bindings from C and C++ declarations for use from Rust.
- How it is used
- Generates Rust bindings for an NGINX C API as part of an incremental Rust integration.
- How deep it goes
- Works through header setup, build-script configuration, output inclusion, filtering, and generated bitfield accessors.
- Examples
- Uses NGINX headers, an ngx_-filtered binding file, and response-buffer bitfield setters.
- What you can do after
- Apply it via bindgen to generate and include selected C API bindings in a Rust project.
Embedded Software with Rust
bindgen is a tool that generates Rust foreign-function interface declarations from C and C++ headers.
- How it is used
- Generates Rust FFI declarations from C headers for embedded integration with existing C libraries.
- How deep it goes
- Walks through command-line generation, filtering, target configuration, build-script automation, linking, inclusion, and an unsafe call.
- Examples
- Uses a hardware abstraction header with a struct and pointer-taking function, plus generated bindings and a call.
- What you can do after
- Apply it via bindgen to generate target-specific Rust declarations and include them in a Cargo project.
Read how Embedded Software with Rust explains rust bindgen →
Also covered in
What to know first
- RustRust is a statically typed systems programming language designed for performance, concurrency, and memory safety without requiring garbage collection.
Related concepts
- bindingproduces · A binding is a declaration or interface layer that makes functions, types, or other APIs from one language or library accessible to code in another language.
- cbindgencontrasts with · cbindgen is a tool that generates C and C++ header files from Rust source code.
- build scriptused by · A build script is an executable program or declarative specification that automates or configures tasks for building software artifacts.
- C bindingsproduces · C bindings are interfaces and declarations that enable code in another language to call C functions and use C-defined types or data.
Questions about rust bindgen
What is rust bindgen?
rust bindgen is a code-generation tool that generates Rust foreign-function interface bindings from C and C++ declarations.
Which Manning books explain rust bindgen?
Refactoring to Rust and Embedded Software with Rust.
What should I know before learning rust bindgen?
Manning books that teach rust bindgen usually introduce Rust first.
What is the difference between rust bindgen and cbindgen?
rust bindgen is a code-generation tool that generates Rust foreign-function interface bindings from C and C++ declarations. cbindgen is a tool that generates C and C++ header files from Rust source code.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

