pub struct MfFunctionHelper<S> { /* private fields */ }
Expand description
用于注册特定状态类型 S
的函数的辅助结构。
Implementations§
Source§impl<S: Send + Sync + 'static> MfFunctionHelper<S>
impl<S: Send + Sync + 'static> MfFunctionHelper<S>
Sourcepub fn register_function(
&self,
name: String,
params: Vec<VariableType>,
return_type: VariableType,
executor: Box<dyn Fn(&Arguments<'_>, Option<&S>) -> AnyhowResult<Variable> + 'static>,
) -> Result<(), String>
pub fn register_function( &self, name: String, params: Vec<VariableType>, return_type: VariableType, executor: Box<dyn Fn(&Arguments<'_>, Option<&S>) -> AnyhowResult<Variable> + 'static>, ) -> Result<(), String>
注册一个自定义函数。
§Parameters
name
: 函数名。params
: 函数参数类型列表。return_type
: 函数返回类型。executor
: 函数的实现,它接收参数和一个可选的Arc<S>
状态引用。
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for MfFunctionHelper<S>
impl<S> RefUnwindSafe for MfFunctionHelper<S>where
S: RefUnwindSafe,
impl<S> Send for MfFunctionHelper<S>where
S: Send,
impl<S> Sync for MfFunctionHelper<S>where
S: Sync,
impl<S> Unpin for MfFunctionHelper<S>where
S: Unpin,
impl<S> UnwindSafe for MfFunctionHelper<S>where
S: UnwindSafe,
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