Crate trillium_askama

source ·
Expand description

provides support for using the askama compile-time template library with trillium. see https://github.com/djc/askama for more information about using askama.

use trillium::Conn;
use trillium_askama::{AskamaConnExt, Template};

#[derive(Template)]
#[template(path = "examples/hello.html")]
struct HelloTemplate<'a> {
    name: &'a str,
}

async fn handler(conn: Conn) -> Conn {
    conn.render(HelloTemplate { name: "trillium" })
}

use trillium_testing::prelude::*;
assert_ok!(
    get("/").on(&handler),
    "Hello, trillium!",
    "content-type" => "text/html"
);

Re-exports§

  • pub use askama;

Traits§

  • extends trillium conns with the ability to render askama templates
  • Main Template trait; implementations are generally derived

Derive Macros§