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§
- Context
- The struct that holds the context of a template rendering.
- Tera
- Main point of interaction in this library.
- Tera
Handler
Traits§
- Filter
- The filter function type definition
- Function
- The global function type definition
- Tera
Conn Ext - Extends trillium::Conn with tera template-rendering functionality.
- Test
- The tester function type definition