Hi rustaceans,
I'd like to share RsHtml, a template engine I developed for Rust. RsHtml is a compile-time, type-safe, lightweight, and flexible template engine for Rust. It aims to seamlessly integrate Rust code with HTML content. It allows developers to write dynamic templates that embed Rust expressions and makes it easier to generate HTML content programmatically. It generates efficient Rust code for template rendering at compile time. Take a look at how HTML and Rust integrate.
HTML inside Rust:
let user_info = v!(<p>name: {user.name}</p>);
v! {
<div class="user-info"> {user_info} </div>
}
Rust inside HTML:
@if self.is_logged_in {
<p>Hello, @self.username!</p>
} else {
<p>Please log in to continue.</p>
}
<ul>
@for item in self.items {
<li>@item</li>
}
</ul>
Is this the best library out there? It certainly feels that way to me ![]()
Crates.io: https://crates.io/crates/rshtml
GitHub: https://github.com/rshtml/rshtml
Doc: https://rshtml.github.io
I'd love to hear suggestions and ideas from anyone interested. Any kind of feedback and support is valuable to me. Thanks rustaceans.