Skip to content
Sergio Alejandro Ribera Costa edited this page Oct 15, 2023 · 1 revision

Welcome to the SrTemplate wiki!

Features

  • Super fast
  • Efficient
  • Renders variables of all types
  • Function system
  • Easy implementation of custom functions
  • Minimum possible dependencies
  • Feature-based implementations, use only what you need
  • Using the same variables renders multiple times

Basic example

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());
}
Clone this wiki locally