Crates.io | russx |
lib.rs | russx |
version | 0.3.4 |
source | src |
created_at | 2023-10-24 08:11:31.200858 |
updated_at | 2023-12-01 07:10:05.464043 |
description | A rust template library |
homepage | https://github.com/PizzasBear/russx |
repository | https://github.com/PizzasBear/russx |
max_upload_size | |
id | 1012173 |
size | 23,449 |
Russx implements a template rendering engine based on rstml. It generates Rust code from your templates at compile time using a macro. This crate is inpired by both Askama and Leptos.
First, add the russx dependancy to your crate's Cargo.toml
:
cargo add russx
In any Rust file inside your crate, add the following:
use russx::Template;
russx::templates! {
pub fn hello<'a>(name: &'a str) {
<p>Hello, {name}!</p>
}
}
fn main() {
let html = hello("world").render().unwrap();
println!("{html}");
}
You should be able to compile and run this code.