FunctionHandler

Trait FunctionHandler 

Source
pub trait FunctionHandler: Send + Sync {
    // Required method
    fn call(
        &self,
        context: &mut dyn ContextLike,
        args: Vec<Arc<Value>>,
    ) -> Result<Value>;
}
Expand description

Handler invoked for a registered function or method.

Required Methods§

Source

fn call( &self, context: &mut dyn ContextLike, args: Vec<Arc<Value>>, ) -> Result<Value>

Call the function with the provided arguments.

§Arguments
  • context - The evaluation context for closures
  • args - A slice of Value arguments passed to the function
§Returns

Returns a Result<Value> containing the function result or an error if the function execution fails.

§Note

For method calls, the first argument is typically the value the method is being called on, followed by any additional arguments.

Implementors§