pub struct Template {Show 17 fields
pub name: String,
pub description: Option<String>,
pub source_dir: PathBuf,
pub data: IndexMap<Id, Value>,
pub interview: Vec<Node>,
pub root: PathBuf,
pub partials: Partials,
pub files: Vec<FileRule>,
pub inject: Vec<InjectRule>,
pub ignore: GlobSet,
pub static_files: GlobSet,
pub hooks: Vec<HookNode>,
pub messages: ApplyMessages,
pub requires: Vec<Requirement>,
pub interview_hook_nodes: Vec<Value>,
pub top_hook_nodes: Vec<Value>,
pub render_program: Vec<SourceEntry>,
/* private fields */
}Fields§
§name: String§description: Option<String>§source_dir: PathBuf§data: IndexMap<Id, Value>§interview: Vec<Node>§root: PathBuf§partials: PartialsThe single include-confinement owner for this template’s file bodies,
created once from the canonical root. It is retained so a source-tree
body compiled during a later load step, and every stored files: body,
resolves includes against the same root without a runtime loader.
files: Vec<FileRule>§inject: Vec<InjectRule>§ignore: GlobSet§static_files: GlobSet§hooks: Vec<HookNode>§messages: ApplyMessages§requires: Vec<Requirement>The programs that must be on PATH before the interview starts, in
declaration order.
interview_hook_nodes: Vec<Value>Parsed, post-!include, pre-render interview hook node values, in
interview order. The reviewable surface reads these, so any field —
known or future — is covered without changing review code.
top_hook_nodes: Vec<Value>Parsed, post-!include, pre-render top-level hook node values, in list
order.
render_program: Vec<SourceEntry>The retained, compiled source-tree render program, in deterministic walk order. Planning renders these; it does not reopen a Jinja source after admission.
Implementations§
Source§impl Template
impl Template
Sourcepub fn admit_environment(
&self,
decision: EnvironmentDecision,
source: &mut impl FixedEnvironmentSource,
) -> Result<EnvironmentSnapshot, EnvironmentAdmissionError>
pub fn admit_environment( &self, decision: EnvironmentDecision, source: &mut impl FixedEnvironmentSource, ) -> Result<EnvironmentSnapshot, EnvironmentAdmissionError>
Combines the immutable render-program analysis with one caller decision, capturing the closed five-value environment snapshot exactly once when granted and never otherwise.
Sourcepub fn reserves_context(&self) -> bool
pub fn reserves_context(&self) -> bool
Whether this template reserves and exposes the seventeen context names.
Source§impl Template
impl Template
Sourcepub fn load(folder: &Path) -> Result<Self, LoadError>
pub fn load(folder: &Path) -> Result<Self, LoadError>
Loads a template in the current context mode: the seventeen reserved names collide with authored ids and resolve as available references.
Sourcepub fn requirements(&self) -> Vec<Requirement>
pub fn requirements(&self) -> Vec<Requirement>
The programs that must be on PATH before the interview starts, in
order: the declared requires entries, then git when the template has
a git question and does not declare git itself. The pre-interview
check reads this list, not the field.
Sourcepub fn load_legacy(folder: &Path) -> Result<Self, LoadError>
pub fn load_legacy(folder: &Path) -> Result<Self, LoadError>
Loads a template in legacy staged mode: the seventeen names are neither reserved nor available, so a pre-context authored identifier is not turned into a collision while its old stage is completed.