varj

A string interpolation utility to replace Mustache like placeholders with stored variables.
- Works as an extremely lightweight template library
- Does not require template compilation
- Simply replaces
{{ key }}withvalue - Whitespace surrounding the key is ignored:
{{key}}and{{ key }}are equal.
Interact with this utility via VarjMap.
Examples
Basic usage:
let mut vars = new;
vars.insert;
let expected = "value";
let actual = vars.parse?;
assert_eq!;
With a json string:
let mut variables = new;
variables.insert;
variables.insert;
let json = r#"{
"name" = "{{ name }}",
"age" = {{ age }}
}"#;
let expected = r#"{
"name" = "Christopher",
"age" = 30
}"#;
let actual = variables.parse?;
assert_eq!;
VarjMap implements From<HashMap> and can be converted back to one when
needed. This is useful if you want to build a VarjMap from an iterator,
or itererate over one. See example.
License
Varj is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.