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 (plans/03-runtime.md §2.7). 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 const fn with_dates(self, f: &'static dyn Function) -> Registry
pub const fn with_dates(self, f: &'static dyn Function) -> Registry
This registry, with f formatting unannotated date/time values
(Arg::DateTime, CustomValue has no say): mf2-fn-datetime, as
:datetime with its defaults (plans/03-runtime.md §2.7). The
evaluator asks f whether such a value formats, its direction, text,
sub-parts and part kind; it does not select. Without it an
unannotated date/time is a Bad Operand, so no date code is linked.