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
impl Clone for CompositeFunction
Source§fn clone(&self) -> CompositeFunction
fn clone(&self) -> CompositeFunction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl FunctionDefinition for CompositeFunction
impl FunctionDefinition for CompositeFunction
Source§fn required_parameters(&self) -> usize
fn required_parameters(&self) -> usize
返回最少参数数量(所有重载中参数最少的)
Source§fn optional_parameters(&self) -> usize
fn optional_parameters(&self) -> usize
返回可选参数数量(最多参数数量 - 最少参数数量)
Source§fn check_types(&self, args: &[Rc<VariableType>]) -> FunctionTypecheck
fn check_types(&self, args: &[Rc<VariableType>]) -> FunctionTypecheck
检查参数类型是否匹配任一重载
Source§fn param_type(&self, index: usize) -> Option<VariableType>
fn param_type(&self, index: usize) -> Option<VariableType>
获取指定位置的参数类型(所有重载中该位置类型的并集)
Source§fn param_type_str(&self, index: usize) -> String
fn param_type_str(&self, index: usize) -> String
获取指定位置参数类型的字符串表示(包含所有可能的类型)
Source§fn return_type(&self) -> VariableType
fn return_type(&self) -> VariableType
获取返回类型(所有重载返回类型的并集)
Source§fn return_type_str(&self) -> String
fn return_type_str(&self) -> String
获取返回类型的字符串表示(包含所有可能的返回类型)
Auto Trait Implementations§
impl Freeze for CompositeFunction
impl !RefUnwindSafe for CompositeFunction
impl !Send for CompositeFunction
impl !Sync for CompositeFunction
impl Unpin for CompositeFunction
impl !UnwindSafe for CompositeFunction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more