Skip to main content

FunctionResolver

Trait FunctionResolver 

Source
pub trait FunctionResolver {
    // Required method
    fn call(&self, name: &str, args: &Map<String, Value>) -> Option<Value>;
}
Expand description

Supplies renderer-side functions to formatString beyond the built-ins.

This crate does not render, so it evaluates only what it can decide on its own: data-model paths and @index. Pass a resolver to Scope::format_string_with to evaluate catalog functions such as formatDate or formatCurrency.

Required Methods§

Source

fn call(&self, name: &str, args: &Map<String, Value>) -> Option<Value>

Evaluates name with the given already-resolved arguments.

Return None for a function this resolver does not know; the caller then reports it as an unknown function.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F> FunctionResolver for F
where F: Fn(&str, &Map<String, Value>) -> Option<Value>,