a multi-language bindings generator for rust
Перейти к файлу
Jan-Erik Rediger 61811c77e0 Regression test for doc annotations parsing failure 2024-06-17 12:27:43 +02:00
.cargo Updating the docs tooling around the release process 2023-12-12 11:11:39 -05:00
.circleci Deploy the docs site using mike (#2139) 2024-05-31 10:06:49 -04:00
.github Add full team as CODEOWNERS 2022-06-09 19:06:26 +02:00
docker Switch to portable bash shebang (#1876) 2023-12-01 09:54:03 +01:00
docs Fix broken overview link in docs (#2140) 2024-06-01 09:13:38 -04:00
examples Added ffi-buffer scaffolding functions 2024-05-06 12:57:39 -04:00
fixtures Regression test for doc annotations parsing failure 2024-06-17 12:27:43 +02:00
tools Fix typo in tools/requirements_docs.txt (#2138) 2024-05-30 11:31:57 -04:00
uniffi chore: Release 2024-06-11 14:17:56 -04:00
uniffi_bindgen chore: Release 2024-06-11 14:17:30 -04:00
uniffi_build chore: Release 2024-06-11 14:17:30 -04:00
uniffi_checksum_derive chore: Release 2024-06-11 14:17:30 -04:00
uniffi_core chore: Release 2024-06-11 14:17:30 -04:00
uniffi_macros chore: Release 2024-06-11 14:17:30 -04:00
uniffi_meta chore: Release 2024-06-11 14:17:30 -04:00
uniffi_testing chore: Release 2024-06-11 14:17:30 -04:00
uniffi_udl chore: Release 2024-06-11 14:17:30 -04:00
weedle2 Bump weedle2 to 5.0.0 2024-01-25 10:32:01 -05:00
.dockerignore Update our rust policy to match mozilla-central's 'uses' version (#470) 2021-06-02 14:51:55 +10:00
.gitignore Move doc generation to mkdocs. (#2077) 2024-05-05 14:42:08 -04:00
CHANGELOG.md chore: Release 2024-06-11 14:17:56 -04:00
CODE_OF_CONDUCT.md Remove `./` from paths, make `CODE_OF_CONDUCT.md` non-executable (#1545) 2023-05-17 08:54:56 -04:00
Cargo.lock Regression test for doc annotations parsing failure 2024-06-17 12:27:43 +02:00
Cargo.toml Regression test for doc annotations parsing failure 2024-06-17 12:27:43 +02:00
LICENSE Add more README, and a walkthrough of the (barely) working example. 2020-06-10 21:27:43 +10:00
README.md Fix a typo 2024-03-07 00:20:48 +01:00
mkdocs.yml Introduce `mike` to the doc generation process. (#2132) 2024-05-30 09:25:22 -04:00
release.toml Correct the process description: releasing backend crates will not automatically create a tag 2023-06-21 15:28:37 +02:00
rust-toolchain.toml Update Rust to 1.77.1, min supported Rust to 1.74 2024-04-05 09:30:35 -04:00

README.md

UniFFI - a multi-language bindings generator for Rust

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

For the impatient, see the UniFFI user guide or the UniFFI examples.

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.

You can describe your object model in an interface definition file or by using proc-macros.

UniFFI is currently used 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.

UniFFI 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.

User Guide

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]

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:

  • Plugin support for .udl files 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.
  • Cargo NDK Gradle Plugin allows you to build Rust code using cargo-ndk, which generally makes Android library builds less painful.
  • uniffi-starter is a minimal project demonstrates a wide range of UniFFI in a complete project in a compact manner. It includes a full Android library build process, an XCFramework generation script, and example Swift package structure.

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

Contributing

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.