A compiled ~STAR rendering program. Compiler output; not a construction API.
run is a capture-free function generated by the ~STAR compiler from one
template skeleton. values holds the already-evaluated expressions of one
snapshot. The function owns every static byte and the template structure:
run.(:render, values)returns HTML iodata.run.(:nodes, values)returns the equivalentStarView.Template.Nodelist, which may contain nested programs.run.(:key, values)returns the item key for keyed collections, ornil.- Any other mode or a malformed
valuestuple raisesArgumentError.
Rendering and materializing never evaluate template expressions again; they
only read values. values is ordinary data and may be replaced or mutated,
so the generated code escapes and validates it on every call exactly like a
hand-built tree. There is no cached HTML, static data or tree in the struct.
run is executable code and is trusted like a Phoenix.HTML.Safe
implementation: whoever supplies it chooses the markup. Programs are
ordinary server-side values. They are not meant to be serialized or accepted
from untrusted transports.
In modules, the compiler emits hidden named functions and stores external
captures. Snapshots do not pin old module code. An unchanged program works
after recompilation; a removed program raises StarView.Template.StaleProgramError.
Diffing treats this as :template_changed, including nested programs.
Moduleless evaluation and templates expanded after the compiler hook use local functions instead. Those values have the ordinary code-lifetime limits of local functions. They are intended for immediate evaluation.
Summary
Functions
Returns the program's nodes with nested programs and templates expanded.
Types
Functions
@spec nodes(t()) :: [StarView.Template.Node.t()]
Returns the program's nodes with nested programs and templates expanded.