Overview
Horrorshow is a macro-based HTML templating library that is compatible with stable Rust. It requires Rust version 1.48 or higher. The library is designed to degrade gracefully when compiled without the standard library (std
) or the allocation library (alloc
).
Features
- Degrades Gracefully: The crate can be compiled without
std
oralloc
, and it will still function, albeit with some limitations. - Compatible with alloc: When compiled with
alloc
library, theTemplate::write_to_io()
method is available for rendering templates to an output stream. - Compatible with core: When compiled with just the
core
library, theRenderBox
type is not available, and only theTemplate::write_to_fmt()
method for rendering templates to a formatted string is available.
Installation
To install the Horrorshow library, follow these steps:
- Ensure you have Rust version 1.48 or higher installed.
- Add
horrorshow
as a dependency in yourCargo.toml
file:Replace[dependencies] horrorshow = "version"
"version"
with the desired version of the Horrorshow library. - Run
cargo build
to download and build the library.
Summary
Horrorshow is a versatile macro-based HTML templating library for Rust. It provides a range of features and is compatible with different configurations of the standard library, allowing for flexible usage depending on the requirements of your project. With its ability to degrade gracefully, Horrorshow ensures that your templates can still be rendered even without certain dependencies.