NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #4747 most downloaded on crates.io
a multi-language bindings generator for rust (checksum custom derive)
Last release 2 years ago
no release in 18 months
Ships fairly regularly
a new release about every 5 weeks
Nearly every release is documented
notes for 21 of 21 stable releases
Nothing withdrawn
no release was ever pulled
4 years old
21 releases · first in 2022
One column per quarter.
Fixed bug in metadata extraction with large ELF files.
Added the uniffi-bindgen-swift binary. It works like uniffi-bindgen but with additional Swift-specific features. See https://mozilla.github.io/uniffi-
Added the uniffi-bindgen-swift binary. It works like uniffi-bindgen but with additional
Swift-specific features. See
https://mozilla.github.io/uniffi-rs/latest/swift/uniffi-bindgen-swift.html for details.
Removed the old and outdated diplomat comparison doc
Proc-macros recognise when you are exporting an impl Trait for Struct block.
Python supports this by generating an inheritance hierarcy to reflect that.
#2204
uniffi.toml of crates without a lib type where ignored in 0.28.1Lift errors will not cause an abort when panic=abort is set.
panic=abort is set.cargo_metadata feature, which is on by default. In some cases, this can be disabled
for better compatibility with projects that don't use cargo.--metadata-no-deps is available to avoid processing
cargo_metadata for all dependencies.[Rust=] attribute and use a plain-old typedef.
See the manual page for this.This means if they will work if they happen to be keywords in the language. There's a very small risk of this being a breaking change if you used a ty…
Objects error types can now be as Result<> error type without wrapping them in Arc<>.
Swift errors now provide localizedDescription (#2116)
Procmacros support tuple-errors (ie, enums used as errors can be tuple-enums.)
Fixed a problem with procmacro defined errors when the error was not used as an Err result
in the namespace (#2108)
Custom Type names are now treated as type names by all bindings. This means if they will work if they happen to be keywords in the language. There's a very small risk of this being a breaking change if you used a type name which did not already start with a capital letter, but this changes makes all type naming consistent. (#2073)
Macros uniffi::method and uniffi::constructor can now be used with
cfg_attr. (#2113)
Python: Fix custom types generating invalid code when there are forward references. (#2067)
The internal bindings generation has changed to make it friendlier for external language bindings. However, this a breaking change for these bindings. No consumers of any languages are impacted, only the maintainers of these language bindings. (#2066), (#2094)
The async runtime can be specified for constructors/methods, this will override the runtime specified at the impl block level.
Removed dependencies on unicode-linebreak and unicode-width. They were being pulled in a sub-dependencies for the textwrap crate, but weren't really u
unicode-linebreak and unicode-width. They were being pulled in a
sub-dependencies for the textwrap crate, but weren't really useful.Added the scaffolding-ffi-buffer-fns feature. When enabled, UniFFI will generate an alternate FFI layer that can simplify the foreign bindings code. I
scaffolding-ffi-buffer-fns feature. When enabled, UniFFI will generate an alternate
FFI layer that can simplify the foreign bindings code. It's currently being tested out for the
gecko-js external binding, but other external bindings may also find it useful.Fixed a regression in 0.27.0 which broke throwing constructors (#2061).
Fixed a regression in 0.27.0 which broke throwing constructors (#2061).
Fixed a RustBuffer memory leak (#2056)
Constructors can be async. Alternate constructors work in Python, Kotlin and Swift; only Swift supports primary constructors.
Constructors can be async. Alternate constructors work in Python, Kotlin and Swift; only Swift supports primary constructors.
Enums created with proc macros can now produce literals for variants in Kotlin and Swift. See the section on enum proc-macros for more information.
Objects can be errors - anywhere you can specify an enum error object you can specify
an Arc<Object> - see the manual.
Functions, methods and constructors exported by procmacros can be renamed for the forgeign bindings. See the procmaco manual section.
Trait interfaces can now have async functions, both Rust and foreign-implemented. See the futures manual section for details.
Procmacros support tuple-enums.
RustBuffer was changed to use u64 fields.
This eliminates panics when the capacity of the vec exceeds i32::MAX.
This can happen with the current Vec implementation when String/Vec sizes approach i32::MAX but don't exceed it.
Proc-macro function/method arguments can now have defaults
Proc-macro record defaults now support empty vecs and Some values.
Swift: Records and Enums without object references can now be made Sendable Swift,
by opting in to new Configuration experimental_sendable_value_types in uniffi.toml.
FfiType::Handle variant. This is a general-purpose opaque handle type used for
passing objects cross the FFI. This type is always 64 bits and replaces the various older handle
types including:
FfiType::RustFutureHandle which was removed)FfiType::RustFutureContinuationData which was moved).RustBuffer.len and RustBuffer.capacity are now u64 rather than i32.The weedle2 version is now 5.0.0 rather than 4.0.1. 4.0.1 was yanked because it contained a breaking change.
5.0.0 rather than 4.0.1. 4.0.1 was yanked because it contained a breaking change.The rust_future_continuation_callback_set FFI function was removed. rust_future_poll now inputs the callback pointer. External bindings authors will n
rust_future_continuation_callback_set FFI function was removed. rust_future_poll now
inputs the callback pointer. External bindings authors will need to update their code.Display, Hash and Eq exposed to Kotlin and Swift #1817[WithForeign] attribute#[uniffi::export(with_foreign)] attributeArc<>.Switched to a patched version of oneshot so that consumers who use cargo vendor don't vendor loom and it's sub-dependencies like windows
oneshot so that consumers who use cargo vendor don't vendor
loom and it's sub-dependencies like windowsFixed regression in the name of error enums in Kotlin #1842
Fixed several bugs with async functions were defined in multiple crates that get built together.
Proc-macros can now expose standard Rust traits (eg, Display, Eq, etc)
Proc-macros can now expose standard Rust traits (eg, Display, Eq, etc)
Fixed issues when trying to combine UDL and procmacros in the same crate when the "namespace" is different from the crate name. This meant that the "ffi namespace" has changed to consistently be the crate name, rather than either the crate name or the namespace name depending on whether the item was declared via a procmacro or UDL. This should be invisible in most cases, but custom build environments might require some changes. Specifically:
uniffi::generate_scaffolding(udl_path) now uses the udl_path to locate the corresponding Cargo.toml, which
is parsed to determine the crate name (ie, the name under the [lib] entry). If your environment is such that
Cargo.toml can't be located or parsed, you should instead use uniffi::generate_scaffolding_for_crate(udl_path, crate_name).uniffi_bindgen from the command-line to generate bindings and when not using "library mode",
Cargo.toml will be located and parsed to determine the crate name. Specifying --crate-name on the command-line can
be used to avoid this and use the specified value.Crates can now use proc-macros without UDL files to export their interface. See the "Procedural Macros: Attributes and Derives" manual section for details.
Custom Types are now supported for proc-macros, including a very low-friction way of exposing types implementing the new-type idiom.
Proc-macros: Added support for ByRef arguments
Proc-macros: Implemented custom type conversion error handling (https://mozilla.github.io/uniffi-rs/udl/custom_types.html#error-handling-during-conversion)
Error types must now implement Error + Send + Sync + 'static.
Proc-macros: The handle_unknown_callback_error attribute is no longer needed for callback
interface errors
equals function should be used instead.From<uniffi::UnexpectedUniFFICallbackError is now optional for callback interface error types.
If the error type implements that, things will continue to work as before.
If not, then any unexpected callback error will result in a Rust panic.uniffi_macros: Force-include the Cargo.toml to read
Inline the metadata module in uniffi_meta to avoid a dependency of uniffi_core to avoid hitting an upstream bug during link time
uniffi_meta to avoid a dependency of uniffi_core to avoid hitting an upstream bug during link time (#1666)Python: remove unused import (and unbreak Python 3.6 compatibility)
There are many breaking changes for external bindings - we hope there will be fewer in later releases, but we are laying the groundwork for some nice…
ThreadSafe attribute.External types now require a valid crate name. Before the docs said it must be a crate name,
but any string could be used as long as it was consistent with the external type map in
uniffi.toml.External types must be available in the Rust crate root.ExternalBindingsConfig trait was replaced with BindingsConfig. External bindings implementations will need to make minor changes to implement the new trait instead.--config flag when running the scaffolding command. This flag has never an effect, because there was no scaffolding configuration options.generate --library [path-to-cdylib]. This mode simplifies bindings generation, especially when you have dependencies between multiple UniFFIed crates. See the tutorial for a description.include_scaffolding!() macro must now either be called from your crate root or you must have use the_mod_that_calls_include_scaffolding::* in your crate root. This was always the expectation, but wasn't required before. This will now start failing with errors that say crate::UniFfiTag does not exist.uniffi_types module is no longer needed when using proc-macros.interface by using a [Trait] attribute in the UDL.
See the documentation.bytes primitive type was added, it represents an array of bytes. It maps to ByteArray in Kotlin, bytes in Python, String with Encoding::BINARY in Ruby and Data in Swift. (#1543)str() representations of errors in Python to align with other exceptions in Python. Use repr() or the {!r} format to get the old representation back (#1556)Debug, Display, Eq and Hash can now be exposed over the FFI and bindings may implement special methods for them.
See the documentation.There are many breaking changes for external bindings - we hope there will be fewer in later releases, but we are laying the groundwork for some nice improvements. Significant patches to UniFFI's builtin bindings which you will need to port include:
The version numbers for each crate will no longer by kept in sync after this release. In particular uniffi will have breaking changes less often than…
Cargo.toml file to only depend on the uniffi crate. Follow the directions from the Prerequisites section of the manualuniffi-bindgen binary for your project. Follow the directions from the Foreign language bindings section of the manual.uniffi_bindgen: cargo uninstall uniffi_bindgen. (Not strictly necessary, but you won't be using it anymore).uniffi_bindgen no longer provides a standalone binary. Having a standalone binary resulted in version mismatches when the uniffi version specified in Cargo.toml didn't match the uniffi_bindgen version installed on the system. Read The foreign language bindings section of the manual for how to set up a uniffi-bindgen binary that's local to your workspace.uniffi_bindgen: Removed the run_main function. It's moved to uniffi::uniffi_bindgen_main and now unconditionally succeeds rather than return a Result<()>.uniffi crate and no longer need to depend on uniffi_bindgen, uniffi_build, etc.uniffi will have breaking changes less often than uniffi_bindgen and other crates. This means that UniFFI consumers that specify their versions like uniffi = "0.23" will not need to bump their uniffi version as often as before.uniffi_bindgen: Renamed FFIArgument, FFIFunction and FFIType to FfiArgument, FfiFunction and FfiType
uniffi_bindgen: Renamed FFIArgument, FFIFunction and FFIType to
FfiArgument, FfiFunction and FfiTyperustfmtReplace checksum mechanism for function naming to give consistent results, independent of the target's endianness and bit width. This should have no v
Your coding agent can read these notes before it upgrades. Set up the MCP server →