From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- .../rust/uniffi_bindgen/src/scaffolding/mod.rs | 36 ++-------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'third_party/rust/uniffi_bindgen/src/scaffolding/mod.rs') 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"), - 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"), - Type::External { name, .. } => format!("r#{name}"), - }) - } - - // Map a type to Rust code that specifies the FfiConverter implementation. - // - // This outputs something like `>` - pub fn ffi_trait(type_: &Type, trait_name: &str) -> Result { - Ok(match type_ { Type::External { name, - kind: ExternalKind::Interface, + kind: ExternalKind::Trait, .. - } => { - format!("<::std::sync::Arc as ::uniffi::{trait_name}>") - } - _ => format!( - "<{} as ::uniffi::{trait_name}>", - type_rs(type_)? - ), - }) - } - - pub fn return_type(callable: &T) -> Result { - 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"), + Type::External { name, .. } => format!("r#{name}"), }) } -- cgit v1.2.3