Explore FFI design patterns in Rust
mainWhen writing Foreign Function Interface (FFI) code in Rust, use specific design patterns to manage the boundary between safe and unsafe code and to ensure memory safety. This repository provides guidance on two primary approaches:
- Object-Based API Design: Focuses on creating APIs with strong memory safety characteristics and a clear distinction between safe and unsafe boundaries.
- Type Consolidation into Wrappers: Involves grouping multiple Rust types into a single opaque "object" to simplify the interface presented to foreign code.