Skip to main content

Module functions

Module functions 

Source
Expand description

The functions an expression can call (spec §8.2), each with its signatures, what it gives and examples: the md. functions, the functions and methods the profile takes from CEL, and its macros. One catalog, for an editor’s completion and hover, a reference page and a language server; the processor’s own hints read it too.

let functions = compmd::functions::all();
let currency = functions.iter().find(|f| f.name == "md.currency").unwrap();
assert_eq!(currency.signatures[0].written, "md.currency(n: number, code: string) → string");
assert_eq!(currency.examples[0].expression, r#"md.currency(price * 10, "USD")"#);
assert_eq!(currency.examples[0].result, serde_json::json!("$120.00"));

Structs§

Example
A call of a function, and what it gives at a render at 2026-10-21T10:00:00Z, in UTC, in English.
Function
A function an expression can call.
Param
A param of a signature.
Signature
One way to call a function.

Enums§

Kind
Where a function comes from.

Functions§

all
Every function an expression can call: the md. functions, then CEL’s, then the macros, each in the order the spec lists it.
of_type
The functions a value of type ty is called with as value.f(…): CEL’s methods whose receiver takes it, then the comprehensions, for a list, a map or a record, and optMap and optFlatMap for an optional. A date takes what a string takes, and dyn, whose type is known only when evaluated, takes them all; a number, a bool or null takes none.