pub struct StaticFunction {
pub signature: FunctionSignature,
pub implementation: Rc<dyn Fn(Arguments<'_>) -> Result<Variable>>,
}Expand description
静态函数
具有固定签名的函数实现
Fields§
§signature: FunctionSignature函数签名
implementation: Rc<dyn Fn(Arguments<'_>) -> Result<Variable>>函数实现
Trait Implementations§
Source§impl Clone for StaticFunction
impl Clone for StaticFunction
Source§fn clone(&self) -> StaticFunction
fn clone(&self) -> StaticFunction
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 StaticFunction
impl FunctionDefinition for StaticFunction
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 StaticFunction
impl !RefUnwindSafe for StaticFunction
impl !Send for StaticFunction
impl !Sync for StaticFunction
impl Unpin for StaticFunction
impl !UnwindSafe for StaticFunction
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