sailfish/examples/include.rs

17 lines
316 B
Rust
Raw Normal View History

2024-03-11 17:33:11 -04:00
use sailfish::RenderOnce;
2020-06-06 09:49:27 -04:00
2024-03-11 17:33:11 -04:00
#[derive(RenderOnce)]
2020-06-06 09:49:27 -04:00
#[template(path = "include.stpl")]
struct Include {
title: String,
name: String,
2020-06-06 09:49:27 -04:00
}
fn main() {
let ctx = Include {
title: "Website".to_owned(),
name: "Hanako".to_owned(),
2020-06-06 09:49:27 -04:00
};
println!("{}", ctx.render_once_to_string().unwrap());
2020-06-06 09:49:27 -04:00
}