a multi-language bindings generator for rust
Перейти к файлу
Ben Dean-Kawamura e7a4130d2d Updating the foreign executor API
Added parameters/return values to signal failure.  In particular, we
need a way to signal that the foreign executor has been cancelled/closed
and therefore any futures that depend on it should be halted.  This is
needed to fix #1669.

Updated the Rust code to check for executor failures.  We need to
release any references passed to the waker callback since that callback
will not run in that case.

Updated the foreign code to handle cancelled futures.

Reworked and updated unit tests to test the new system.

Bumped `UNIFFI_CONTRACT_VERSION` since this requires changing the
scaffolding API.  I think this is correct, although you could make the
argument that it's not needed since the async code is still fairly
experimental.

Updated the `uniffi-versioning.md` doc now that
`UNIFFI_CONTRACT_VERSION` lives in `uniffi_meta`.
2023-08-16 15:12:17 -04:00
.cargo Started to setup the new release process 2023-01-25 13:56:29 -05:00
.circleci CI: Add mypy checks 2023-06-16 14:52:15 +02:00
.github Add full team as CODEOWNERS 2022-06-09 19:06:26 +02:00
docker Update Rust to 1.69, MSRV to 1.66.0 2023-06-06 10:54:27 +02:00
docs Updating the foreign executor API 2023-08-16 15:12:17 -04:00
examples Remove outdated comment in example script 2023-08-10 16:21:21 +02:00
fixtures Updating the foreign executor API 2023-08-16 15:12:17 -04:00
uniffi Added suport for using external types in proc-macros 2023-06-29 09:41:07 -04:00
uniffi_bindgen Updating the foreign executor API 2023-08-16 15:12:17 -04:00
uniffi_build chore: Release 2023-06-23 12:16:38 +02:00
uniffi_checksum_derive chore: Release 2023-06-23 12:16:38 +02:00
uniffi_core Updating the foreign executor API 2023-08-16 15:12:17 -04:00
uniffi_macros Allow use of `uniffi::custom_newtype!` from non-root modules (#1691) 2023-08-10 10:36:11 -04:00
uniffi_meta Updating the foreign executor API 2023-08-16 15:12:17 -04:00
uniffi_testing chore: Release 2023-06-23 12:16:38 +02:00
uniffi_udl Remove almost all references to `DOMString` (#1659) 2023-07-24 10:05:38 -04:00
weedle2 Remove `./` from paths, make `CODE_OF_CONDUCT.md` non-executable (#1545) 2023-05-17 08:54:56 -04:00
.dockerignore
.gitignore Started to setup the new release process 2023-01-25 13:56:29 -05:00
CHANGELOG.md Updating the foreign executor API 2023-08-16 15:12:17 -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.toml Re-allow more complex custom types in UDL (#1690) 2023-08-09 09:57:42 -04:00
LICENSE
README.md Add cargo swift to "External resources" section 2023-08-14 10:24:01 +02: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.69, MSRV to 1.66.0 2023-06-06 10:54:27 +02:00

README.md

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

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.