Crates.io | srtemplate |
lib.rs | srtemplate |
version | 0.3.3 |
created_at | 2023-10-15 20:32:09.978119+00 |
updated_at | 2025-04-05 07:44:57.915962+00 |
description | Template String blazing fast with dependencyless |
homepage | https://github.com/SergioRibera/srtemplate |
repository | https://github.com/SergioRibera/srtemplate |
max_upload_size | |
id | 1004101 |
size | 84,718 |
Mr. strings template is a library that allows you to render just text templates.
[!NOTE] See more examples here
use srtemplate::SrTemplate;
fn main() {
let mut ctx = SrTemplate::default();
ctx.add_variable("var", &"World");
ctx.add_variable("otherVar", &"Other");
ctx.add_variable("number", &85u8);
let template = "Hello {{ var }}! This is {{ otherVar }} and this is number: {{number}}";
println!("Rendered: {}", ctx.render(template).unwrap());
}
[!NOTE] For more information about the functions implemented by default or how to use the library in depth, see the wiki