summaryrefslogtreecommitdiffstats
path: root/third_party/rust/uniffi_bindgen/src/scaffolding/mod.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /third_party/rust/uniffi_bindgen/src/scaffolding/mod.rs
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--third_party/rust/uniffi_bindgen/src/scaffolding/mod.rs36
1 files changed, 3 insertions, 33 deletions
diff --git a/third_party/rust/uniffi_bindgen/src/scaffolding/mod.rs b/third_party/rust/uniffi_bindgen/src/scaffolding/mod.rs
index f3759cf6fa..7fd81831aa 100644
--- a/third_party/rust/uniffi_bindgen/src/scaffolding/mod.rs
+++ b/third_party/rust/uniffi_bindgen/src/scaffolding/mod.rs
@@ -45,7 +45,6 @@ mod filters {
format!("std::sync::Arc<{}>", imp.rust_name_for(name))
}
Type::CallbackInterface { name, .. } => format!("Box<dyn r#{name}>"),
- Type::ForeignExecutor => "::uniffi::ForeignExecutor".into(),
Type::Optional { inner_type } => {
format!("std::option::Option<{}>", type_rs(inner_type)?)
}
@@ -64,41 +63,12 @@ mod filters {
kind: ExternalKind::Interface,
..
} => format!("::std::sync::Arc<r#{name}>"),
- Type::External { name, .. } => format!("r#{name}"),
- })
- }
-
- // Map a type to Rust code that specifies the FfiConverter implementation.
- //
- // This outputs something like `<MyStruct as Lift<crate::UniFfiTag>>`
- pub fn ffi_trait(type_: &Type, trait_name: &str) -> Result<String, askama::Error> {
- Ok(match type_ {
Type::External {
name,
- kind: ExternalKind::Interface,
+ kind: ExternalKind::Trait,
..
- } => {
- format!("<::std::sync::Arc<r#{name}> as ::uniffi::{trait_name}<crate::UniFfiTag>>")
- }
- _ => format!(
- "<{} as ::uniffi::{trait_name}<crate::UniFfiTag>>",
- type_rs(type_)?
- ),
- })
- }
-
- pub fn return_type<T: Callable>(callable: &T) -> Result<String, askama::Error> {
- let return_type = match callable.return_type() {
- Some(t) => type_rs(&t)?,
- None => "()".to_string(),
- };
- match callable.throws_type() {
- Some(t) => type_rs(&t)?,
- None => "()".to_string(),
- };
- Ok(match callable.throws_type() {
- Some(e) => format!("::std::result::Result<{return_type}, {}>", type_rs(&e)?),
- None => return_type,
+ } => format!("::std::sync::Arc<dyn r#{name}>"),
+ Type::External { name, .. } => format!("r#{name}"),
})
}