UNSAFE & FFI
Writing correct unsafe code. Calling C libraries from Rust and exposing Rust APIs to C. Raw pointers, transmute, and invariants.
The Rustonomicon — full book
The definitive guide to unsafe Rust. Covers raw pointers, FFI, atomics, and the rules for writing safe abstractions over unsafe code.
bindgen — automatic Rust FFI bindings to C
Generates Rust bindings from C/C++ headers automatically. Essential for integrating any C library into Rust.
Bindgen User Guide
Step-by-step guide to generating and using FFI bindings. Covers annotations, allowlists, and opaque types.