3 releases (breaking)
0.3.0 | Mar 24, 2022 |
---|---|
0.2.0 | Mar 17, 2022 |
0.1.0 | Feb 17, 2022 |
#104 in #warnings
Used in temply
50KB
1.5K
SLoC
temply
temply is a simple, opinionated template engine. The syntax is derived from Jinja. Templates can be defined inline or in an external file and are validated at compile time.
Warning: temply currently does not handle html-escaping and is therefore not suitable for html templates. You may be looking for askama or ructe.
Example
use temply::Template;
#[derive(Debug, Template)]
#[template_inline = "Hello {{ name }}!"]
struct MyTemplate<'a> {
name: &'a str
}
fn main() {
// Init template
let template = MyTemplate { name: "World" };
// Render
let mut buffer = String::new();
template.render(&mut buffer).unwrap();
assert_eq!(buffer, "Hello World!");
}
Dependencies
~1.5MB
~37K SLoC