pub struct Registry { /* private fields */ }Expand description
The function handlers an application links: closed world (B13). Build
code generates it from exactly the functions the corpus uses, e.g.
static REGISTRY: Registry = Registry::new(&[("integer", &mf2_runtime::functions::INTEGER)]); — an unused handler is never
referenced, so never linked.
Implementations§
Source§impl Registry
impl Registry
Sourcepub const fn new(
functions: &'static [(&'static str, &'static dyn Function)],
) -> Registry
pub const fn new( functions: &'static [(&'static str, &'static dyn Function)], ) -> Registry
The registry of functions: (identifier, handler), the identifier
as the catalog’s FUNCS has it (ns:name, NFC). The first entry of a
repeated identifier wins.
Sourcepub const fn with_numbers(self, f: &'static dyn Function) -> Registry
pub const fn with_numbers(self, f: &'static dyn Function) -> Registry
This registry, with f formatting unannotated numeric values
(integer, float and decimal arguments): mf2-fn-number’s localized
exact value. The evaluator checks such a
value as any unannotated value (a non-finite float is a Bad Operand)
and then asks f for its direction, text, sub-parts and part kind;
it still does not select. Without it they format in neutral digits
(§2.6).
Sourcepub fn is_date_function(&self, name: &str) -> bool
pub fn is_date_function(&self, name: &str) -> bool
Whether name (a FUNCS identifier) is a handler here that formats
dates: its parts are "datetime" (Function::part_kind).