Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#### v0.10.0+v0.31.2

----
- Core: Update bindgen to UniFFI v0.31.2
- Core: Objects are passed across the FFI as `uint64_t` handles instead of raw pointers
- Core: Trait interfaces distinguish Rust- and C++-implemented objects when lifting and lowering, and implement the new `uniffi_clone` vtable entry
- Core: Support methods and exported `Display`/`Debug`/`Eq`/`Hash`/`Ord` traits on records, enums and errors (flat enums get free functions)
- Core: Support the `Ord` trait (`cmp`) on objects
- Core: Support tuple-style enum variants with unnamed fields
- Core: Support `#[uniffi(default)]` without a literal using C++ value initialization (`{}`)
- Core: Fix optional enum default values rendering with the wrong type
- Core: Fix duplicate type definitions when a record or enum references the same type more than once
- Core: Async functions, constructors and methods are omitted with a warning instead of aborting generation; async callback interfaces are still unsupported

#### v0.9.0+v0.29.4

----
Expand Down
59 changes: 59 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,20 @@ Regardless of the generation method, these files are produced:
# How to integrate bindings

To integrate the bindings into your projects, simply add the generated bindings files to your project.
C++20 is required to compile the bindings.
C++17 or newer is required to compile the bindings.

# Async functions

Rust async functions, constructors, and object methods return a move-only `uniffi::Future<T>`.
The future supports `get()`, `wait()`, `wait_for()`, and `cancel()`. Destroying an incomplete future
also requests cancellation. Each in-flight Rust future uses a dedicated worker thread to serialize
its UniFFI poll, cancel, complete, and free operations.

# Unsupported features

The following uniffi features are unsupported.

* Async functions
* Async callback-interface methods

# Configuration options

Expand Down
1 change: 1 addition & 0 deletions bindgen/src/bindings/cpp/gen_cpp/filters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ pub(crate) fn ffi_type_name(ffi_type: &FfiType) -> Result<String> {
FfiType::VoidPointer => "void *".into(),
FfiType::RustBuffer(_) => "RustBuffer".into(),
FfiType::ForeignBytes => "ForeignBytes".into(),
FfiType::Callback(name) if name == "RustFutureContinuationCallback" => name.clone(),
FfiType::Callback(_) => "void *".into(),
FfiType::Struct(name) => ffi_struct_name(name)?,
FfiType::RustCallStatus => "RustCallStatus*".into(),
Expand Down
39 changes: 26 additions & 13 deletions bindgen/src/bindings/cpp/gen_cpp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,7 @@ impl<'a> ScaffoldingHeader<'a> {
.flat_map(|o| o.vtable_definition()),
)
.map(Into::into)
.chain(
self.ci
.iter_ffi_function_definitions_non_async()
.map(Into::into),
)
.chain(self.ci.iter_ffi_function_definitions().map(Into::into))
}
}

Expand Down Expand Up @@ -171,19 +167,36 @@ impl<'a> CppWrapperHeader<'a> {
// We take into account only the Record and Enum types, as they are the
// only types that can have member variables that reference other structures
match type_ {
Type::Record { name, .. } => self
.ci
.get_record_definition(name.as_str())
.map(|record| (name, record.iter_types())),
Type::Enum { name, .. } => self
.ci
.get_enum_definition(name.as_str())
.map(|enum_| (name, enum_.iter_types())),
Type::Record { name, .. } => {
self.ci.get_record_definition(name.as_str()).map(|record| {
(
name,
record
.fields()
.iter()
.flat_map(Field::iter_types)
.collect::<Vec<_>>(),
)
})
}
Type::Enum { name, .. } => {
self.ci.get_enum_definition(name.as_str()).map(|enum_| {
(
name,
enum_
.variants()
.iter()
.flat_map(Variant::iter_types)
.collect::<Vec<_>>(),
)
})
}
_ => None,
}
})
.flat_map(|(name, types)| {
types
.into_iter()
.filter_map(type_name)
.map(|field_name| DependencyLink {
prec: field_name,
Expand Down
7 changes: 0 additions & 7 deletions bindgen/src/bindings/cpp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,6 @@ impl BindingGenerator for CppBindingGenerator {
);
}

if ci.has_async_fns() {
eprintln!(
"Warning: omitting unsupported async functions from namespace: {}",
ci.namespace()
);
}

if self.scaffolding_mode {
unimplemented!("Cpp scaffolding is not supported yet!");
} else {
Expand Down
Loading
Loading