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::{HandlebarsHandler, HandlebarsConnExt};
18//! let handler = (
19//! HandlebarsHandler::new("**/*.hbs"),
20//! |mut conn: trillium::Conn| async move {
21//! conn.assign("name", "handlebars")
22//! .render("examples/templates/hello.hbs")
23//! }
24//! );
25//!
26//! use trillium_testing::prelude::*;
27//! assert_ok!(get("/").on(&handler), "hello handlebars!");
28//! # }
29//! ```
30
31pub use handlebars;
32pub use handlebars::Handlebars;
33
34mod assigns;
35pub use assigns::Assigns;
36
37mod handlebars_handler;
38pub use handlebars_handler::HandlebarsHandler;
39
40mod handlebars_conn_ext;
41pub use handlebars_conn_ext::HandlebarsConnExt;