temply 0.3.0

Simple, opinionated template engine
Documentation
  • Coverage
  • 75%
    3 out of 4 items documented2 out of 4 items with examples
  • Size
  • Source code size: 50.03 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.26 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • jannik4/temply
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jannik4

temply

Build Status crates.io docs.rs codecov

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!");
}