pub struct CustomFunctionDefinition {
pub name: String,
pub signature: FunctionSignature,
pub executor: CustomFunctionExecutor,
}Expand description
自定义函数定义
Fields§
§name: String函数名称
signature: FunctionSignature函数签名
executor: CustomFunctionExecutor执行器
Implementations§
Source§impl CustomFunctionDefinition
impl CustomFunctionDefinition
pub fn new( name: String, signature: FunctionSignature, executor: CustomFunctionExecutor, ) -> Self
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
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