Crate rshtml

Crate rshtml 

Source
Expand description

Crates.io Version GitHub Repository Docs.rs Documentation Full Documentation

§RsHtml: A Template Engine for Seamless HTML and Rust Integration.

RsHtml is a powerful template engine that transforms your HTML templates into highly efficient Rust code at compile time, allowing you to seamlessly use Rust logic and expressions together with HTML to harness the full power of Rust for dynamic content generation. It is designed to help you build flexible and maintainable web applications.

Demo

§Quick Start

1. Add to Cargo.toml:

[dependencies]
rshtml = "0.5.0" # Use the latest version
use rshtml::{traits::View, v};
use std::fmt;

fn main() -> fmt::Result {
  let template = "RsHtml";
  let hello = v!(<p>Hello {template}</p>);

  let mut out = String::with_capacity(hello.text_size());

  hello.render(&mut out)?;
  
  print!("{out}");

  Ok(())
}

Modules§

traits

Macros§

v

Structs§

EscapingWriter
Exp
Expr
TextSize
ViewFn
ViewIter

Functions§

track_views_folder

Type Aliases§

Block

Derive Macros§

RsHtml
The primary derive macro for enabling RsHtml templating on a struct.