pub trait ScalarFunction: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn info(&self) -> FunctionInfo;
fn evaluate(&self, args: &[Value]) -> Result<Value>;
fn clone_box(&self) -> Box<dyn ScalarFunction>;
// Provided method
fn native_fn1(&self) -> Option<NativeFn1> { ... }
}Expand description
Trait for scalar functions
Required Methods§
Sourcefn info(&self) -> FunctionInfo
fn info(&self) -> FunctionInfo
Get function information
Sourcefn evaluate(&self, args: &[Value]) -> Result<Value>
fn evaluate(&self, args: &[Value]) -> Result<Value>
Evaluate the function with the given arguments
Sourcefn clone_box(&self) -> Box<dyn ScalarFunction>
fn clone_box(&self) -> Box<dyn ScalarFunction>
Clone the function into a new instance
Provided Methods§
Sourcefn native_fn1(&self) -> Option<NativeFn1>
fn native_fn1(&self) -> Option<NativeFn1>
Optional: Return a direct function pointer for single-arg functions. When Some, compiler emits direct call (no dynamic dispatch). Default is None (uses evaluate() with dynamic dispatch).