Crates.io | srtemplate |
lib.rs | srtemplate |
version | 0.3.0 |
source | src |
created_at | 2023-10-15 20:32:09.978119 |
updated_at | 2024-04-01 04:44:34.435591 |
description | Template String made with nom parser |
homepage | https://github.com/SergioRibera/srtemplate |
repository | https://github.com/SergioRibera/srtemplate |
max_upload_size | |
id | 1004101 |
size | 59,259 |
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