Function rubble_templates::compile_template_from_file [−][src]
pub fn compile_template_from_file(
file: PathBuf,
variables: HashMap<String, String>,
functions: HashMap<String, Box<dyn Function>>
) -> Result<String, Box<dyn Error>>
Compiles template from file.
This function reads a file and uses supplied variables and functions to compile a template. It is a quick way to get a compiled template, as it initializes Engine and Compiler with each invocation.
For some special cases consider using SimpleEvaluationEngine, TemplateCompiler or other specific Evaluator and Compiler traits implementations.
Template can look like the following: Some template {{ variable }} - or something
.
Code that will be evaluated should be put between {{
and }}
.