Crate trillium_tera
source ·Expand description
§this crate provides the tera templating language for trillium
See the tera site for more information on the tera template language.
use trillium::Conn;
use trillium_tera::{TeraHandler, Tera, TeraConnExt};
let mut tera = Tera::default();
tera.add_raw_template("hello.html", "hello {{name}} from {{render_engine}}")?;
let handler = (
TeraHandler::new(tera),
|conn: Conn| async move { conn.assign("render_engine", "tera") },
|conn: Conn| async move {
conn.assign("name", "trillium").render("hello.html")
}
);
use trillium_testing::prelude::*;
assert_ok!(
get("/").on(&handler),
"hello trillium from tera",
"content-type" => "text/html"
);
Structs§
- The struct that holds the context of a template rendering.
- Main point of interaction in this library.
Traits§
- The filter function type definition
- The global function type definition
- Extends trillium::Conn with tera template-rendering functionality.
- The tester function type definition