#ffi #bindgen

bin+lib uniffi_bindgen

a multi-language bindings generator for rust (codegen and cli tooling)

34 releases (20 breaking)

Uses new Rust 2021

0.21.0 Oct 14, 2022
0.19.6 Aug 31, 2022
0.19.3 Jul 8, 2022
0.17.0 Feb 3, 2022
0.5.0 Nov 9, 2020

#68 in Development tools

Download history 3052/week @ 2022-08-17 3105/week @ 2022-08-24 3565/week @ 2022-08-31 4159/week @ 2022-09-07 5500/week @ 2022-09-14 4825/week @ 2022-09-21 4286/week @ 2022-09-28 4561/week @ 2022-10-05 6177/week @ 2022-10-12 5948/week @ 2022-10-19 5084/week @ 2022-10-26 7051/week @ 2022-11-02 7019/week @ 2022-11-09 7787/week @ 2022-11-16 7057/week @ 2022-11-23 6524/week @ 2022-11-30

30,133 downloads per month
Used in 8 crates (3 directly)

MPL-2.0 license

14K SLoC

Rust 10K SLoC // 0.1% comments Kotlin 1K SLoC // 0.2% comments Swift 1K SLoC // 0.1% comments Python 1K SLoC // 0.1% comments Ruby 852 SLoC // 0.1% comments

UniFFI - a multi-language bindings generator for Rust

UniFFI is a toolkit for building cross-platform software components in Rust.

By writing your core business logic in Rust and describing its interface in a special interface definition file, you can use UniFFI to help you:

  • Compile your Rust code into a shared library for use on different target platforms.
  • Generate bindings to load and use the library from different target languages.

For example, UniFFI is currently used in the mozilla/application-services project to build browser storage and syncing functionality for Firefox mobile browsers. Core functionality is written once in Rust, and auto-generated bindings allow that functionality to be called from both Kotlin (for Android apps) and Swift (for iOS apps).

Currently supported "foreign" languages include Kotlin, Swift, Python and Ruby. In general, we'd welcome contributions of other foreign bindings, but we recommend you contact the team first - see the contributing section below.

User Guide

You can read more about using the tool in the UniFFI user guide.

Please be aware that UniFFI is being developed concurrently with its initial consumers, so it is changing rapidly and there are a number of sharp edges to the user experience. Still, we consider is developed enough for production use in Mozilla products and we welcome any feedback you may have about making it more broadly useful.

Etymology and Pronunciation

ˈjuːnɪfaɪ. Pronounced to rhyme with "unify".

A portmanteau word that also puns with "unify", to signify the joining of one codebase accessed from many languages.

uni - [Latin ūni-, from ūnus, one] FFI - [Abbreviation, Foreign Function Interface]

Alternative tools

Other tools we know of which try and solve a similarly shaped problem are:

(Please open a PR if you think other tools should be listed!)


If this tool sounds interesting to you, please help us develop it! You can:

Code of Conduct

This project is governed by Mozilla's Community Participation Guidelines.


~119K SLoC