Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

FFI Patterns

Writing FFI code is an entire course in itself. However, there are several idioms here that can act as pointers, and avoid traps for inexperienced users of unsafe Rust.

This section contains design patterns that may be useful when doing FFI.

  1. Object-Based API design that has good memory safety characteristics, and a clean boundary of what is safe and what is unsafe

  2. Type Consolidation into Wrappers - group multiple Rust types together into an opaque “object”

Last change: , commit: 4ba2ec1