Expand description
Rusty Handlebars - A type-safe Handlebars templating engine for Rust
This crate provides a type-safe implementation of the Handlebars templating engine with a focus on compile-time template processing and HTML safety.
§Features
- Type-safe templating with compile-time validation
- HTML escaping for secure output
- Optional HTML minification
- Derive macro support for easy integration
- Flexible display traits for both regular and HTML-safe output
- Optional parser functionality
§Examples
use rusty_handlebars::WithRustyHandlebars;
#[derive(WithRustyHandlebars)]
#[template(path = "templates/hello.hbs")]
struct HelloTemplate {
name: String,
}
For HTML-safe output:
use rusty_handlebars::AsDisplayHtml;
let html = "<script>alert('xss')</script>";
let safe_html = html.as_display_html().to_string();
// Output: <script>alert('xss')</script>
Re-exports§
pub use as_bool::AsBool;
Modules§
- as_bool
- Boolean conversion trait for various Rust types
Traits§
- AsDisplay
- Trait for converting values to a Display implementation
- AsDisplay
Html - Trait for converting values to an HTML-safe Display implementation
- With
Rusty Handlebars - Trait that must be implemented for types that can be used with Handlebars templates
Derive Macros§
- With
Rusty Handlebars - Derive macro for implementing Handlebars templating on structs Derive macro for implementing Handlebars templating