Skip to main content

DelegateExpressionFfi

Struct DelegateExpressionFfi 

Source
pub struct DelegateExpressionFfi { /* private fields */ }
Expand description

Foreign function interface for composition animations based on calling closures.

Functions are overloaded by name, argument count and argument types. A call first looks for an overload whose parameter types are exactly the argument types, in registration order; then for one reachable by widening single-precision vector arguments to the double-precision vector types; then for one reachable by converting between the two vector families in either direction.

Implementations§

Source§

impl DelegateExpressionFfi

Source

pub fn new() -> Self

Creates an empty registry.

Source

pub fn add0<R, F>(&mut self, name: &str, cb: F)
where R: Into<ExpressionVariant>, F: Fn() -> R + Send + Sync + 'static,

Registers a function without parameters.

Source

pub fn add1<T1, R, F>(&mut self, name: &str, cb: F)
where T1: ExpressionVariantValue, R: Into<ExpressionVariant>, F: Fn(T1) -> R + Send + Sync + 'static,

Registers a function with one parameter.

Source

pub fn add2<T1, T2, R, F>(&mut self, name: &str, cb: F)
where T1: ExpressionVariantValue, T2: ExpressionVariantValue, R: Into<ExpressionVariant>, F: Fn(T1, T2) -> R + Send + Sync + 'static,

Registers a function with two parameters.

Source

pub fn add3<T1, T2, T3, R, F>(&mut self, name: &str, cb: F)
where T1: ExpressionVariantValue, T2: ExpressionVariantValue, T3: ExpressionVariantValue, R: Into<ExpressionVariant>, F: Fn(T1, T2, T3) -> R + Send + Sync + 'static,

Registers a function with three parameters.

Source

pub fn add4<T1, T2, T3, T4, R, F>(&mut self, name: &str, cb: F)

Registers a function with four parameters.

Source

pub fn add5<T1, T2, T3, T4, T5, R, F>(&mut self, name: &str, cb: F)

Registers a function with five parameters.

Source

pub fn add6<T1, T2, T3, T4, T5, T6, R, F>(&mut self, name: &str, cb: F)

Registers a function with six parameters.

As in the reference implementation, the sixth parameter is read from the fifth argument.

Source

pub fn add16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R, F>( &mut self, name: &str, cb: F, )

Registers a function with sixteen parameters.

As in the reference implementation, the sixth to sixteenth parameters are read from the fifth argument.

Trait Implementations§

Source§

impl Default for DelegateExpressionFfi

Source§

fn default() -> Self

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

impl IExpressionForeignFunctionInterface for DelegateExpressionFfi

Source§

fn call( &self, name: &str, arguments: &[ExpressionVariant], ) -> Option<ExpressionVariant>

Calls the function with the given name and arguments. Returns None when there is no function with that name accepting the arguments.

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> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.