Navigating the code
The code for UniFFI is organized into the following crates:
-
./uniffi
(docs.rs, source): The main entry-point to UniFFI - almost all consumers should be able to use facilities expored by this module. -
./uniffi_bindgen
(docs.rs, source): The the source for theuniffi-bindgen
executable and is where most of the logic for the foreign bindings generation lives. Its contents include:./uniffi_bindgen/src/interface/
: Convertinguniffi_meta
types into an in-memory representation calledComponentInterface
, from which we can generate code for different languages../uniffi_bindgen/src/scaffolding
: This module generates.rs
files for the parts of theComponentInterface
defined in UDL./uniffi_bindgen/src/bindings/
: This module turns aComponentInterface
into foreign-language bindings, the code that can load the FFI layer exposed by Rust and expose it as a higher-level API in a target language. There is a sub-module for each internally supported language.
-
./uniffi_meta
(docs.rs, source): The types used to represent the metadata used to describe theComponentInterface
used to generate the Rust scaffolding and the foreign bindings. -
./uniffi_udl
(docs.rs, source) : The parsing of UDL files, turning them intouniffi_meta
types. -
./uniffi_build
(docs.rs, source): A small hook to rununiffi-bindgen
from thebuild.rs
script of a UniFFI component, in order to automatically generate the Rust scaffolding as part of its build process. -
./uniffi_macros
(docs.rs, source): Contains the proc_macro support, which does much of the heavy-lifting for defining the Rust FFI. -
./examples
: Contains code examples demonstrating the capabilites and code generation process. -
./fixtures
: Our test suite.