Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changes for C# 0.28.0 #16

Open
wants to merge 2 commits into
base: merge/v0.28.0
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion uniffi_bindgen/src/bindings/swift/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub use test::{run_script, run_test};

/// The Swift bindings generated from a [`crate::ComponentInterface`].
///
struct Bindings {
pub struct Bindings {
/// The contents of the generated `.swift` file, as a string.
library: String,
/// The contents of the generated `.h` file, as a string.
Expand Down
11 changes: 6 additions & 5 deletions uniffi_bindgen/src/interface/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,10 @@ pub struct FfiFunction {
pub(super) arguments: Vec<FfiArgument>,
pub(super) return_type: Option<FfiType>,
pub(super) has_rust_call_status_arg: bool,
/// Used by C# generator to differentiate the free function and call it with void*
/// Used by C# generator to differentiate the clone function and call it with void*
/// instead of C# `SafeHandle` type. See <https://github.com/mozilla/uniffi-rs/pull/1488>.
pub(super) is_object_free_function: bool,
/// Update 2024-08-02: changed this from `is_free` to `is_clone`.
pub(super) is_object_clone_function: bool,
}

impl FfiFunction {
Expand Down Expand Up @@ -240,8 +241,8 @@ impl FfiFunction {
self.has_rust_call_status_arg
}

pub fn is_object_free_function(&self) -> bool {
self.is_object_free_function
pub fn is_object_clone_function(&self) -> bool {
self.is_object_clone_function
}

pub fn init(
Expand All @@ -267,7 +268,7 @@ impl Default for FfiFunction {
arguments: Vec::new(),
return_type: None,
has_rust_call_status_arg: true,
is_object_free_function: false,
is_object_clone_function: false,
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions uniffi_bindgen/src/interface/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ impl ComponentInterface {
arguments: vec![],
return_type: Some(FfiType::UInt32),
has_rust_call_status_arg: false,
is_object_free_function: false,
is_object_clone_function: false,
}
}

Expand All @@ -440,7 +440,7 @@ impl ComponentInterface {
}],
return_type: Some(FfiType::RustBuffer(None)),
has_rust_call_status_arg: true,
is_object_free_function: false,
is_object_clone_function: false,
}
}

Expand All @@ -457,7 +457,7 @@ impl ComponentInterface {
}],
return_type: Some(FfiType::RustBuffer(None)),
has_rust_call_status_arg: true,
is_object_free_function: false,
is_object_clone_function: false,
}
}

Expand All @@ -474,7 +474,7 @@ impl ComponentInterface {
}],
return_type: None,
has_rust_call_status_arg: true,
is_object_free_function: false,
is_object_clone_function: false,
}
}

Expand All @@ -497,7 +497,7 @@ impl ComponentInterface {
],
return_type: Some(FfiType::RustBuffer(None)),
has_rust_call_status_arg: true,
is_object_free_function: false,
is_object_clone_function: false,
}
}

Expand All @@ -522,7 +522,7 @@ impl ComponentInterface {
],
return_type: None,
has_rust_call_status_arg: false,
is_object_free_function: false,
is_object_clone_function: false,
}
}

Expand All @@ -539,7 +539,7 @@ impl ComponentInterface {
}],
return_type: return_ffi_type,
has_rust_call_status_arg: true,
is_object_free_function: false,
is_object_clone_function: false,
}
}

Expand All @@ -554,7 +554,7 @@ impl ComponentInterface {
}],
return_type: None,
has_rust_call_status_arg: false,
is_object_free_function: false,
is_object_clone_function: false,
}
}

Expand All @@ -569,7 +569,7 @@ impl ComponentInterface {
}],
return_type: None,
has_rust_call_status_arg: false,
is_object_free_function: false,
is_object_clone_function: false,
}
}

Expand Down Expand Up @@ -805,7 +805,7 @@ impl ComponentInterface {
arguments: vec![],
return_type: Some(FfiType::UInt16),
has_rust_call_status_arg: false,
is_object_free_function: false,
is_object_clone_function: false,
})
}

Expand Down
2 changes: 1 addition & 1 deletion uniffi_bindgen/src/interface/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ impl Object {
type_: FfiType::RustArcPtr(self.name.to_string()),
}];
self.ffi_func_clone.return_type = Some(FfiType::RustArcPtr(self.name.to_string()));
self.ffi_func_clone.is_object_clone_function = true;
self.ffi_func_free.arguments = vec![FfiArgument {
name: "ptr".to_string(),
type_: FfiType::RustArcPtr(self.name.to_string()),
}];
self.ffi_func_free.return_type = None;
self.ffi_func_free.is_object_free_function = true;
if self.has_callback_interface() {
self.ffi_init_callback = Some(FfiFunction::callback_init(
&self.module_path,
Expand Down
Loading