# mozilla/uniffi-rs

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/mozilla-uniffi-rs).**

4,326 stars · 300 forks · Rust · mpl-2.0

## Links

- GitHub: https://github.com/mozilla/uniffi-rs
- Homepage: https://mozilla.github.io/uniffi-rs/
- awesome-repositories: https://awesome-repositories.com/repository/mozilla-uniffi-rs.md

## Topics

`ffi-layer` `rust-crate`

## Description

uniffi-rs is a Rust FFI binding generator and multi-language binding tool. It functions as an automated binding scaffolder that creates type-safe foreign function interfaces and native wrappers for Rust libraries in languages such as Swift, Kotlin, and Python.

The project provides a system for cross-language interface definition, allowing functions and data structures to be specified in a shared format to ensure consistent API signatures across platforms. It further serves as an FFI memory management layer, handling object lifetimes and thread safety when sharing state between Rust and foreign language runtimes.

The tool covers broad capability areas including API integration for mapping internal data structures to foreign classes and the automation of binding generation during the build process. It supports the development of multi-platform SDKs by managing the transfer of data, the mapping of errors to native exceptions, and the execution of asynchronous functions across language boundaries.

## Tags

### Development Tools & Productivity

- [FFI Export Macros](https://awesome-repositories.com/f/development-tools-productivity/custom-task-functions/sql-function-namespaces/function-definitions/rust-user-defined-functions/ffi-export-macros.md) — Annotates functions and traits with export macros to expose them across FFI without a separate definition file. ([source](https://mozilla.github.io/uniffi-rs/proc_macro/index.html))
- [Binding Scaffolding Generators](https://awesome-repositories.com/f/development-tools-productivity/metadata-generators/api-binding-generators/binding-scaffolding-generators.md) — Automates creation of boilerplate FFI code and native wrappers to expose Rust functions to foreign languages.
- [Rust Language Binding Generators](https://awesome-repositories.com/f/development-tools-productivity/type-safe-binding-generators/rust-language-binding-generators.md) — Generates type-safe FFI bindings from Rust code to Swift, Kotlin, and Python for cross-platform library use.
- [Kotlin Binding Generators](https://awesome-repositories.com/f/development-tools-productivity/type-safe-binding-generators/rust-language-binding-generators/kotlin-binding-generators.md) — Creates type-safe Kotlin bindings from Rust interface definitions for Android and JVM use. ([source](https://mozilla.github.io/uniffi-rs/))
- [Swift Binding Generators](https://awesome-repositories.com/f/development-tools-productivity/type-safe-binding-generators/rust-language-binding-generators/swift-binding-generators.md) — Creates type-safe Swift bindings from Rust interface definitions for iOS and macOS use. ([source](https://mozilla.github.io/uniffi-rs/))

### Mobile Development

- [Multi-Platform SDK Development](https://awesome-repositories.com/f/mobile-development/multi-platform-sdk-development.md) — Builds multi-platform SDKs by defining Rust interfaces once and producing native wrappers for iOS, Android, and desktop.
- [Rust Mobile Library Integrations](https://awesome-repositories.com/f/mobile-development/mobile-binary-compilation/mobile-framework-libraries/rust-mobile-library-integrations.md) — Integrates Rust libraries into iOS and Android apps with automatic memory management and thread safety.

### Programming Languages & Runtimes

- [FFI Memory Management Bridges](https://awesome-repositories.com/f/programming-languages-runtimes/automatic-memory-management/ffi-memory-management-bridges.md) — Manages Rust object lifetimes and thread safety across the FFI boundary with reference counting.
- [Foreign Function Bindings](https://awesome-repositories.com/f/programming-languages-runtimes/foreign-function-bindings.md) — Produces type-safe native wrappers in Swift, Kotlin, Python, and Ruby that translate idiomatic calls into FFI invocations.
- [FFI Export Proc Macros](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/language-features/metaprogramming/procedural-macros/attribute-macro-code-generators/ffi-export-proc-macros.md) — Exports Rust functions and types to FFI using derive and attribute macros that produce C-compatible entry points.
- [Error-to-Exception Mappings](https://awesome-repositories.com/f/programming-languages-runtimes/async-runtime-bridges/cross-language-async-bridges/error-to-exception-mappings.md) — Maps Rust errors to native exceptions and executes async functions from foreign language runtimes.
- [Rust-C++ Async Bridges](https://awesome-repositories.com/f/programming-languages-runtimes/async-runtime-bridges/rust-c-async-bridges.md) — Bridges Rust async functions to foreign language concurrency primitives like coroutines or callbacks.
- [Pluggable Codegen Architectures](https://awesome-repositories.com/f/programming-languages-runtimes/c-language-bridges/rust-bridges/third-party-crate-bindings/pluggable-codegen-architectures.md) — Provides a pluggable codegen architecture that supports custom binding generators for additional languages.
- [Cross-Language Callbacks](https://awesome-repositories.com/f/programming-languages-runtimes/function-pointer-callbacks/managed-to-native-callbacks/cross-language-callbacks.md) — Exports traits so foreign code can pass callback implementations into Rust functions. ([source](https://mozilla.github.io/uniffi-rs/proc_macro/index.html))
- [FFI Object Exposures](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/type-system-tools/type-definitions/type-aliases/object-aliasing/object-type-restrictions/exact-object-types/ffi-object-exposures.md) — Derives object traits on structs to expose them across FFI with mixed proc-macro and definition methods. ([source](https://mozilla.github.io/uniffi-rs/proc_macro/index.html))
- [Custom FFI Type Mappings](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/foreign-function-interfaces/ffi-type-definitions/rust-c-type-mappings/custom-ffi-type-mappings.md) — Maps Rust types to FFI-compatible representations for automatic cross-language conversion. ([source](https://mozilla.github.io/uniffi-rs/proc_macro/index.html))
- [Rust-to-Python Binding Generators](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/interoperability/python-bindings/rust-to-python-binding-generators.md) — Creates type-safe Python bindings from Rust interface definitions for cross-platform scripting. ([source](https://mozilla.github.io/uniffi-rs/))

### Software Engineering & Architecture

- [Interface Definition Languages](https://awesome-repositories.com/f/software-engineering-architecture/interface-definition-languages.md) — Defines cross-language APIs in a shared UDL file for consistent type signatures across targets.
- [Unified Definition Language Files](https://awesome-repositories.com/f/software-engineering-architecture/interface-definition-languages/unified-definition-language-files.md) — Declares functions and types in a UDL file to expose them to foreign-language bindings. ([source](https://mozilla.github.io/uniffi-rs/udl_file_spec.html))
- [Cross-Language Error Enums](https://awesome-repositories.com/f/software-engineering-architecture/error-handling-strategies/monadic-error-handling/throw-based-error-handlers/cross-language-error-enums.md) — Derives error enums that become native exceptions in foreign code across the FFI boundary. ([source](https://mozilla.github.io/uniffi-rs/proc_macro/index.html))
- [Result-to-Exception Adapters](https://awesome-repositories.com/f/software-engineering-architecture/error-handling/exception-logic-structures/exception-hierarchies/exception-type-enforcers/exception-to-result-adapters/result-to-exception-adapters.md) — Converts Rust Result types and error enums into native exceptions in each foreign language.

### Data & Databases

- [FFI Enum Exposures](https://awesome-repositories.com/f/data-databases/enum-definitions/public-variant-exposure/enum-variant-reexports/ffi-enum-exposures.md) — Derives enum traits to make variants and associated data available across FFI. ([source](https://mozilla.github.io/uniffi-rs/proc_macro/index.html))
- [Cross-Language Data Records](https://awesome-repositories.com/f/data-databases/model-as-a-table-integrations/cross-language-data-records.md) — Derives record traits on structs to make fields accessible as cross-language data types. ([source](https://mozilla.github.io/uniffi-rs/proc_macro/index.html))

### Operating Systems & Systems Programming

- [FFI Thread-Safety Enforcement](https://awesome-repositories.com/f/operating-systems-systems-programming/ffi-thread-safety-enforcement.md) — Handles object lifetimes and thread safety when sharing Rust state with foreign language runtimes.
