What problem does it solve?
This Skill helps Rust developers design safe, portable FFI bindings to expose Rust libraries to other languages by enforcing boundary safety, ABI-stable layouts, and clear ownership semantics.
Core Features & Use Cases
- Safety at the boundary: catch panics, validate inputs, and prevent undefined behavior when crossing language boundaries.
- ABI stability: use
#[repr(C)] on exported types and stable enums to ensure consistent memory layouts across languages.
- Memory ownership & error handling: define explicit ownership models and robust error codes to communicate failures across FFI.
- Binding patterns for multiple targets: C API exports, C# bindings, Python bindings (PyO3), WebAssembly bindings (wasm-bindgen), and UniFFI multi-language bindings.
- Use cases: expose a Rust core (e.g., chart data structures) to C, Python, and JS environments for broader integration.
Quick Start
Install the Rust toolchain, annotate your exported APIs with extern "C" and #[repr(C)], implement panic-safety wrappers, and generate or wire up bindings with UniFFI, wasm-bindgen, or CsBindgen as needed.