Expand description
Lightweight string template engine with variables, conditionals, and loops.
Zero external dependencies. Uses a simple HashMap<String, Value> approach.
§Examples
use philiprehberger_template::{Template, Value};
use std::collections::HashMap;
let tpl = Template::parse("Hello, {name}!").unwrap();
let mut data = HashMap::new();
data.insert("name".into(), Value::from("world"));
assert_eq!(tpl.render(&data).unwrap(), "Hello, world!");Structs§
- Template
- A parsed template that can be rendered with data.
Enums§
- Parse
Error - An error that occurs during template parsing.
- Render
Error - An error that occurs during template rendering.
- Value
- A dynamic value that can be inserted into a template.