pub struct FfiFunction {
    pub(super) name: String,
    pub(super) is_async: bool,
    pub(super) arguments: Vec<FfiArgument>,
    pub(super) return_type: Option<FfiType>,
    pub(super) has_rust_call_status_arg: bool,
    pub(super) is_object_free_function: bool,
}
Expand description

Represents an “extern C”-style function that will be part of the FFI.

These can’t be declared explicitly in the UDL, but rather, are derived automatically from the high-level interface. Each callable thing in the component API will have a corresponding FfiFunction through which it can be invoked, and UniFFI also provides some built-in FfiFunction helpers for use in the foreign language bindings.

Fields§

§name: String§is_async: bool§arguments: Vec<FfiArgument>§return_type: Option<FfiType>§has_rust_call_status_arg: bool§is_object_free_function: bool

Used by C# generator to differentiate the free function and call it with void* instead of C# SafeHandle type. See https://github.com/mozilla/uniffi-rs/pull/1488.

Implementations§

source§

impl FfiFunction

source

pub fn callback_init( module_path: &str, trait_name: &str, vtable_name: String ) -> Self

source

pub fn name(&self) -> &str

source

pub fn is_async(&self) -> bool

source

pub fn arguments(&self) -> Vec<&FfiArgument>

source

pub fn return_type(&self) -> Option<&FfiType>

source

pub fn has_rust_call_status_arg(&self) -> bool

source

pub fn is_object_free_function(&self) -> bool

source

pub fn init( &mut self, return_type: Option<FfiType>, args: impl IntoIterator<Item = FfiArgument> )

Trait Implementations§

source§

impl Clone for FfiFunction

source§

fn clone(&self) -> FfiFunction

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FfiFunction

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for FfiFunction

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<FfiFunction> for FfiDefinition

source§

fn from(value: FfiFunction) -> FfiDefinition

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.