5 unstable releases
0.3.2 | Jan 19, 2024 |
---|---|
0.3.1 | Jan 2, 2024 |
0.3.0 | Mar 7, 2022 |
0.2.0 | Aug 27, 2021 |
0.1.0 | Jun 7, 2021 |
#22 in #tera-templates
51 downloads per month
69KB
971 lines
Welcome to Trillium!
📖 Guide 📖
The guide provides an architectural overview and lay of the land connecting the trillium crates.
📑 Rustdocs 📑
The rustdocs represent the best way to learn about any of trillium's individual crates and the specific interfaces.
Legal:
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
lib.rs
:
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"
);
Dependencies
~13–22MB
~377K SLoC