|new 0.25.3||Dec 7, 2023|
|0.25.2||Nov 20, 2023|
|0.25.1||Nov 9, 2023|
|0.25.0||Oct 18, 2023|
#5 in #ffi-layer
22,076 downloads per month
Used in 10 crates (via uniffi_bindgen)
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 an "object model", 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.
UniFFI is currently extensively by Mozilla in Firefox mobile and desktop browsers; written once in Rust, auto-generated bindings allow that functionality to be called from both Kotlin (for Android apps) and Swift (for iOS apps). It also has a growing community of users shipping various cool things to many users.
UniFII comes with support for Kotlin, Swift, Python and Ruby with 3rd party bindings available for C# and Golang. Additional foreign language bindings can be developed externally and we welcome contributions to list them here. See Third-party foreign language bindings.
You can read more about using the tool in the UniFFI user guide.
We consider it ready for production use, but UniFFI is a long way from a 1.0 release with lots of internal work still going on. We try hard to avoid breaking simple consumers, but more advanced things might break as you upgrade over time.
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]
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
- Kotlin Multiplatform support. The repository contains Kotlin Multiplatform bindings generation for UniFFI, letting you target both JVM and Native.
- Go bindings
- C# bindings
- Dart bindings
There are a few third-party resources that make it easier to work with UniFFI:
- Plugin support for
.udlfiles for the IDEA platform (uniffi-dl in the JetBrains marketplace). It provides syntax highlighting, code folding, code completion, reference resolution and navigation (among others features) for the UniFFI Definition Language (UDL).
- cargo swift, a cargo plugin to build a Swift Package from Rust code. It provides an init command for setting up a UniFFI crate and a package command for building a Swift package from Rust code - without the need for additional configuration or build scripts.
(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:
- View the contributor guidelines.
- File or work on issues here in GitHub.
- Join discussions in the #uniffi:mozilla.org room on Matrix.
Code of Conduct
This project is governed by Mozilla's Community Participation Guidelines.
Uniffi support for webidl syntax, typically from a .udl file, as described by weedle.
This library is dedicated to parsing a string in a webidl syntax, as described by
weedle and with our own custom take on the attributes etc, pushing the boundaries
of that syntax to describe a uniffi
The output of this module is consumed by uniffi_bindgen to generate stuff.