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