Struct CompositeFunction

Source
pub struct CompositeFunction {
    pub signatures: Vec<FunctionSignature>,
    pub implementation: Rc<dyn Fn(Arguments<'_>) -> Result<Variable>>,
}
Expand description

复合函数

支持多个函数重载的函数实现

Fields§

§signatures: Vec<FunctionSignature>

函数重载签名列表

§implementation: Rc<dyn Fn(Arguments<'_>) -> Result<Variable>>

函数实现(需要根据参数类型选择合适的重载)

Trait Implementations§

Source§

impl Clone for CompositeFunction

Source§

fn clone(&self) -> CompositeFunction

Returns a duplicate 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 FunctionDefinition for CompositeFunction

Source§

fn required_parameters(&self) -> usize

返回最少参数数量(所有重载中参数最少的)

Source§

fn optional_parameters(&self) -> usize

返回可选参数数量(最多参数数量 - 最少参数数量)

Source§

fn check_types(&self, args: &[Rc<VariableType>]) -> FunctionTypecheck

检查参数类型是否匹配任一重载

Source§

fn call(&self, args: Arguments<'_>) -> Result<Variable>

执行函数调用

Source§

fn param_type(&self, index: usize) -> Option<VariableType>

获取指定位置的参数类型(所有重载中该位置类型的并集)

Source§

fn param_type_str(&self, index: usize) -> String

获取指定位置参数类型的字符串表示(包含所有可能的类型)

Source§

fn return_type(&self) -> VariableType

获取返回类型(所有重载返回类型的并集)

Source§

fn return_type_str(&self) -> String

获取返回类型的字符串表示(包含所有可能的返回类型)

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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>,

Source§

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>,

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.