pub struct TemplatePreprocessor { /* private fields */ }Expand description
Template rendering preprocessor. Generative (one-way) transform.
Holds the resolved dodot.* map, the user-defined variables, and a
pre-computed context hash. Each expand call constructs a fresh
Tracker, installs the namespaces, registers the source file as a
named template, and renders. We don’t share the Tracker across
renders because add_template requires &mut while Preprocessor:: expand runs through a &self trait method — a per-call tracker is
the simplest way to keep the pipeline’s existing concurrency shape.
Implementations§
Source§impl TemplatePreprocessor
impl TemplatePreprocessor
Sourcepub fn new(
extensions: Vec<String>,
user_vars: HashMap<String, String>,
pather: &dyn Pather,
) -> Result<Self>
pub fn new( extensions: Vec<String>, user_vars: HashMap<String, String>, pather: &dyn Pather, ) -> Result<Self>
Construct a new template preprocessor.
Validates that no user-defined variable uses a reserved name
(dodot or env). Resolves the dodot.* builtins from
pather + system info and computes the context hash now so
every subsequent expand reuses the same value.
Extensions are normalized at construction: a leading dot (e.g.
".tmpl") is stripped so both "tmpl" and ".tmpl" work.
Sourcepub fn with_secret_registry(self, registry: Arc<SecretRegistry>) -> Self
pub fn with_secret_registry(self, registry: Arc<SecretRegistry>) -> Self
Wire a SecretRegistry into this preprocessor. Templates
rendered through it can call {{ secret("op://Vault/Item/Field") }}
(and other configured schemes); calls dispatch through the
registry, populate the per-render sidecar, and refuse
multi-line values per secrets.lex §3.4. Without a registry
(the default), any secret(...) call in a template surfaces
as a render error.
Trait Implementations§
Source§impl Debug for TemplatePreprocessor
impl Debug for TemplatePreprocessor
Source§impl Preprocessor for TemplatePreprocessor
impl Preprocessor for TemplatePreprocessor
Source§fn transform_type(&self) -> TransformType
fn transform_type(&self) -> TransformType
Source§fn supports_reverse_merge(&self) -> bool
fn supports_reverse_merge(&self) -> bool
dodot transform check propagate edits from the deployed file
back into the source by writing a unified diff (and, for
ambiguous edits, dodot-conflict marker blocks). Read moreSource§fn matches_extension(&self, filename: &str) -> bool
fn matches_extension(&self, filename: &str) -> bool
Source§fn stripped_name(&self, filename: &str) -> String
fn stripped_name(&self, filename: &str) -> String
"config.toml.tmpl" → "config.toml".