FuncallHandler

Trait FuncallHandler 

Source
pub trait FuncallHandler {
    // Required methods
    fn call_function(
        &mut self,
        context: &mut Context,
        func: JsonnetValue,
        args: Vec<JsonnetValue>,
    ) -> Result<JsonnetValue>;
    fn is_builtin_function(&self, name: &str) -> bool;
    fn call_builtin_function(
        &mut self,
        context: &mut Context,
        name: &str,
        args: Vec<JsonnetValue>,
    ) -> Result<JsonnetValue>;
    fn is_external_function(&self, name: &str) -> bool;
    fn call_external_function(
        &mut self,
        context: &mut Context,
        name: &str,
        args: Vec<JsonnetValue>,
    ) -> Result<JsonnetValue>;
}
Expand description

Handler for function calls (user-defined, builtin, external)

Required Methods§

Source

fn call_function( &mut self, context: &mut Context, func: JsonnetValue, args: Vec<JsonnetValue>, ) -> Result<JsonnetValue>

Call a function with given arguments

Source

fn is_builtin_function(&self, name: &str) -> bool

Check if a function name refers to a builtin function

Source

fn call_builtin_function( &mut self, context: &mut Context, name: &str, args: Vec<JsonnetValue>, ) -> Result<JsonnetValue>

Call a builtin function

Source

fn is_external_function(&self, name: &str) -> bool

Check if a function name refers to an external function

Source

fn call_external_function( &mut self, context: &mut Context, name: &str, args: Vec<JsonnetValue>, ) -> Result<JsonnetValue>

Call an external function (HTTP, AI API, system commands, etc.)

Implementors§