pub struct MfFunctionDefinition {
pub name: String,
pub signature: FunctionSignature,
pub executor: Box<dyn Fn(&Arguments<'_>, Option<&Arc<dyn Any + Send + Sync>>) -> Result<Variable> + 'static>,
}Expand description
自定义函数定义
Fields§
§name: String函数名称
signature: FunctionSignature函数签名
executor: Box<dyn Fn(&Arguments<'_>, Option<&Arc<dyn Any + Send + Sync>>) -> Result<Variable> + 'static>执行器
Implementations§
Trait Implementations§
Source§impl FunctionDefinition for MfFunctionDefinition
impl FunctionDefinition for MfFunctionDefinition
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 MfFunctionDefinition
impl !RefUnwindSafe for MfFunctionDefinition
impl !Send for MfFunctionDefinition
impl !Sync for MfFunctionDefinition
impl Unpin for MfFunctionDefinition
impl !UnwindSafe for MfFunctionDefinition
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