pub fn call(args: &[Value]) -> Result<Value, FuncError>Expand description
Returns the result of calling the first argument, which must be a function, with the remaining arguments as parameters.
ยงExample
use gtmpl::{gtmpl_fn, template, Value};
use gtmpl_value::{FuncError, Function};
gtmpl_fn!(
fn add(a: u64, b: u64) -> Result<u64, FuncError> {
Ok(a + b)
});
let equal = template(r#"{{ call . 1 2 }}"#, Value::Function(Function { f: add }));
assert_eq!(&equal.unwrap(), "3");