Skip to content

UniFFI

UniFFI is a tool that automatically generates foreign-language bindings targeting Rust libraries. The repository can be found on github. It fits in the practice of consolidating business logic in a single Rust library while targeting multiple platforms, making it simpler to develop and maintain a cross-platform codebase. Note that this tool will not help you ship a Rust library to these platforms, but it will help you avoid writing bindings code by hand. Related.

Design

UniFFI requires you to describe your interface via either proc-macros or in an Interface Definition Language (based on WebIDL) file. These definitions describe the methods and data structures available to the targeted languages, and are used to generate Rust scaffolding code and foreign-language bindings. This process can take place either during the build process or be manually initiated by the developer.

uniffi diagram

Supported languages

  • Kotlin
  • Swift
  • Python
  • Ruby

Third-party foreign language bindings