pub struct TemplatePreprocessor { /* private fields */ }Expand description
Template rendering preprocessor. Generative (one-way) transform.
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). Populates the MiniJinja environment with
the dodot.* builtins from pather + system info, an env.*
dynamic lookup, and each user variable as a bare global.
Extensions are normalized at construction: a leading dot (e.g.
".tmpl") is stripped so both "tmpl" and ".tmpl" work.
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
The safety model for this transformation.
Source§fn matches_extension(&self, filename: &str) -> bool
fn matches_extension(&self, filename: &str) -> bool
Whether this preprocessor handles a file with the given name.
Source§fn stripped_name(&self, filename: &str) -> String
fn stripped_name(&self, filename: &str) -> String
Strip the preprocessor extension to get the logical filename.
e.g.
"config.toml.tmpl" → "config.toml".Auto Trait Implementations§
impl !Freeze for TemplatePreprocessor
impl !RefUnwindSafe for TemplatePreprocessor
impl Send for TemplatePreprocessor
impl Sync for TemplatePreprocessor
impl Unpin for TemplatePreprocessor
impl UnsafeUnpin for TemplatePreprocessor
impl !UnwindSafe for TemplatePreprocessor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more