trillium_tera/lib.rs
1#![forbid(unsafe_code)]
2#![deny(
3 clippy::dbg_macro,
4 missing_copy_implementations,
5 rustdoc::missing_crate_level_docs,
6 missing_debug_implementations,
7 missing_docs,
8 nonstandard_style,
9 unused_qualifications
10)]
11
12/*!
13
14# this crate provides the tera templating language for trillium
15
16See [the tera site](https://tera.netlify.app/) for more information on
17the tera template language.
18
19```
20# fn main() -> tera::Result<()> {
21use trillium::Conn;
22use trillium_tera::{TeraHandler, Tera, TeraConnExt};
23
24let mut tera = Tera::default();
25tera.add_raw_template("hello.html", "hello {{name}} from {{render_engine}}")?;
26
27let handler = (
28 TeraHandler::new(tera),
29 |conn: Conn| async move { conn.assign("render_engine", "tera") },
30 |conn: Conn| async move {
31 conn.assign("name", "trillium").render("hello.html")
32 }
33);
34
35use trillium_testing::prelude::*;
36assert_ok!(
37 get("/").on(&handler),
38 "hello trillium from tera",
39 "content-type" => "text/html"
40);
41# Ok(()) }
42```
43*/
44
45mod tera_handler;
46pub use tera_handler::TeraHandler;
47
48mod tera_conn_ext;
49pub use tera_conn_ext::TeraConnExt;
50
51pub use tera::{Context, Filter, Function, Tera, Test};