pub struct CustomFunctionDefinition {
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 CustomFunctionDefinition
impl FunctionDefinition for CustomFunctionDefinition
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 CustomFunctionDefinition
impl !RefUnwindSafe for CustomFunctionDefinition
impl !Send for CustomFunctionDefinition
impl !Sync for CustomFunctionDefinition
impl Unpin for CustomFunctionDefinition
impl !UnwindSafe for CustomFunctionDefinition
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