44 releases (24 breaking)

new 0.25.2 Nov 20, 2023
0.25.0 Oct 18, 2023
0.24.2 Jul 25, 2023
0.23.0 Jan 27, 2023
0.5.0 Nov 9, 2020

#41 in FFI

Download history 7386/week @ 2023-08-07 8493/week @ 2023-08-14 6144/week @ 2023-08-21 7152/week @ 2023-08-28 9025/week @ 2023-09-04 9024/week @ 2023-09-11 9547/week @ 2023-09-18 7840/week @ 2023-09-25 9608/week @ 2023-10-02 7430/week @ 2023-10-09 8824/week @ 2023-10-16 9473/week @ 2023-10-23 11598/week @ 2023-10-30 12428/week @ 2023-11-06 13626/week @ 2023-11-13 9906/week @ 2023-11-20

48,062 downloads per month
Used in 13 crates (6 directly)

MPL-2.0 license

12K SLoC

Rust 7K SLoC // 0.1% comments Kotlin 1.5K SLoC // 0.2% comments Swift 1.5K SLoC // 0.1% comments Python 1.5K SLoC // 0.1% comments Ruby 1K 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 first-party supported foreign languages include Kotlin, Swift, Python and Ruby. Additional foreign language bindings can be developed externally and we welcome contributions to list them here. See Third-party foreign language bindings.

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!)

Third-party foreign language bindings

External resources

There are a few third-party resources that make it easier to work with UniFFI:

(Please open a PR if you think other resources 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.


~101K SLoC