Skip to main content

FunctionExecutor

Trait FunctionExecutor 

Source
pub trait FunctionExecutor: Send + Sync {
    // Required methods
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        arguments: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_schema(&self) -> FunctionDefinition;

    // Provided method
    fn validate_arguments(&self, _arguments: &Value) -> Result<()> { ... }
}
Expand description

Trait for executing functions

Required Methods§

Source

fn execute<'life0, 'async_trait>( &'life0 self, arguments: Value, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the function with given arguments

Source

fn get_schema(&self) -> FunctionDefinition

Get function schema

Provided Methods§

Source

fn validate_arguments(&self, _arguments: &Value) -> Result<()>

Validate function arguments

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§