trillium_handlebars/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//! Handlebars templating handler for trillium based on [the handlebars
13//! crate](https://docs.rs/crate/handlebars).
14//! ```
15//! # if cfg!(unix) {
16//! # use std::path::PathBuf;
17//! use trillium_handlebars::{HandlebarsConnExt, HandlebarsHandler};
18//! use trillium_testing::TestServer;
19//!
20//! # trillium_testing::block_on(async {
21//! let handler = (
22//! HandlebarsHandler::new("**/*.hbs"),
23//! |mut conn: trillium::Conn| async move {
24//! conn.assign("name", "handlebars")
25//! .render("examples/templates/hello.hbs")
26//! },
27//! );
28//!
29//! let app = TestServer::new(handler).await;
30//! app.get("/")
31//! .await
32//! .assert_ok()
33//! .assert_body("hello handlebars!");
34//! # });
35//! # }
36//! ```
37
38#[cfg(test)]
39#[doc = include_str!("../README.md")]
40mod readme {}
41
42pub use handlebars::{self, Handlebars};
43
44mod assigns;
45pub use assigns::Assigns;
46
47mod handlebars_handler;
48pub use handlebars_handler::HandlebarsHandler;
49
50mod handlebars_conn_ext;
51pub use handlebars_conn_ext::HandlebarsConnExt;