pub struct Template {
pub key: TemplateKey,
pub root: TemplateNode,
pub hole_count: usize,
}Expand description
A full template: the root TemplateNode plus the number of hole slots it
references, keyed by source location for diffing across hot reloads.
hole_count is the slot signature’s core: a template edit that keeps
the same holes (reorder/wrap/retext static elements) is hot-swappable; one
that changes the hole count adds/removes compiled logic and must escalate
(Tier 2 dylib or Tier 0 restart) — D103’s boundary.
Fields§
§key: TemplateKey§root: TemplateNode§hole_count: usizeImplementations§
Source§impl Template
impl Template
Sourcepub fn new(key: TemplateKey, root: TemplateNode) -> Self
pub fn new(key: TemplateKey, root: TemplateNode) -> Self
Build a template from its root node, deriving hole_count from the
holes the tree actually references.
Sourcepub fn hole_signature_matches(&self, other: &Template) -> bool
pub fn hole_signature_matches(&self, other: &Template) -> bool
Whether self and other share the same hole signature — the cheap
test for “is this edit hot-swappable, or does it need code?” A full
per-slot signature comparison arrives with the diff step; hole count is
the necessary first gate (a changed count is always an escalation).