Skip to main content

Module expr

Module expr 

Source
Expand description

UI-6: the template’s expressions — Rhai, over the scope: the props by name, state, each live collection by name ({ rows, status }), and each {#each}’s variable. An expression is compiled once; what it reads is found by scanning its text (Reads), so a binding reads (and so tracks) only the state keys and names it names.

Structs§

Expr
A compiled expression.
Reads
What an expression’s text reads.

Functions§

as_text
A value drawn as text: a string as it is, unit as nothing, anything else as Rhai prints it.
compiles
FRAME-17: how many times an expression went through Rhai’s compiler on this thread (the tests read it).
engine
The expressions’ engine (one per thread: the page has one).
path_of
text as a path — name or name.field…, each an identifier and the first no Rhai word — or none.
scan
The names and state.<key>s in text, string literals skipped.
to_dynamic
A JSON value as Rhai’s.
to_value
Rhai’s value as JSON.
truthy
A value as a condition: a bool as it is; unit false; anything else true.
walk
The value at path (fields after the first) inside v: null where a field is missing, as Rhai reads a map’s missing property.