Expand description
Universal {{namespace.path}} template engine.
Complements $var/${var} interpolation (super::interpolate) with a
syntax that is unambiguous by construction: any {{...}} that doesn’t
match a known namespace path passes through as a literal (no silent-empty,
no escape syntax needed). This lets the engine be applied universally —
including to fields holding secrets, regexes, or $1/$ref values that
the legacy $ syntax would corrupt.
Grammar: {{ \s* <namespace path> \s* }}, no nesting. Namespaces:
request.method|path|host|scheme|bodyrequest.headers.<name>/request.query.<name>/request.cookies.<name>response.status|body,response.headers.<name>message.<key>(key may itself contain dots)client.ip|portenv.<NAME>— resolved at parse time from the process environment (or an injected lookup fn), never at render time.
Anything else — an unrecognized first segment, a malformed remainder
within a known namespace, or an unclosed {{ — passes through literally.
A malformed remainder within a known namespace (and an unset env.*)
additionally produces a warning string from Template::parse.
Template::render_with_legacy applies the legacy interpolate pass to
the template’s literal segments only; rendered {{...}} output is never
$-processed, so runtime data can never become a $var read primitive.
Structs§
- Template
- A parsed template, ready to render repeatedly against different contexts.
Enums§
- Classified 🔒
- Outcome of classifying one
{{...}}occurrence’s trimmed inner text. - Segment
- One chunk of a parsed template: either raw text or a resolvable reference.
- Template
Ref - A single resolvable reference inside a template.
Functions§
- classify 🔒
- classify_
client 🔒 - classify_
env 🔒 - classify_
message 🔒 - classify_
request 🔒 - classify_
response 🔒 - named_
ref 🔒 - Builds a
Refclassification for a<namespace>.<subkey>.<name>leaf, warning instead whennameis empty (e.g.{{request.headers.}}). - render_
ref 🔒 - unknown_
ref_ 🔒warning