diff --git a/uniffi_bindgen/src/interface/function.rs b/uniffi_bindgen/src/interface/function.rs index 95df0e9f5..dc37670de 100644 --- a/uniffi_bindgen/src/interface/function.rs +++ b/uniffi_bindgen/src/interface/function.rs @@ -269,6 +269,9 @@ pub trait Callable { } } + // Scaffolding function + fn ffi_func(&self) -> &FfiFunction; + // Quick way to get the rust future scaffolding function that corresponds to our return type. fn ffi_rust_future_poll(&self, ci: &ComponentInterface) -> String { @@ -312,6 +315,10 @@ impl Callable for Function { fn is_async(&self) -> bool { self.is_async } + + fn ffi_func(&self) -> &FfiFunction { + &self.ffi_func + } } // Needed because Rinja likes to add extra refs to variables @@ -332,6 +339,10 @@ impl Callable for &T { (*self).is_async() } + fn ffi_func(&self) -> &FfiFunction { + (*self).ffi_func() + } + fn takes_self(&self) -> bool { (*self).takes_self() } diff --git a/uniffi_bindgen/src/interface/object.rs b/uniffi_bindgen/src/interface/object.rs index 2848885ab..7a1fd9e28 100644 --- a/uniffi_bindgen/src/interface/object.rs +++ b/uniffi_bindgen/src/interface/object.rs @@ -729,6 +729,10 @@ impl Callable for Constructor { fn is_async(&self) -> bool { self.is_async } + + fn ffi_func(&self) -> &FfiFunction { + &self.ffi_func + } } impl Callable for Method { @@ -751,6 +755,10 @@ impl Callable for Method { fn takes_self(&self) -> bool { true } + + fn ffi_func(&self) -> &FfiFunction { + &self.ffi_func + } } #[cfg(test)]