A string interpolation utility to replace Mustache like placeholders with stored variables.
{{ key }}
with value
Interact with this utility via the parse
function
Basic usage:
```rust use std::collections::HashMap;
let mut vars = HashMap::new(); vars.insert( "key".toowned(), "value".toowned() );
assert_eq!( "value", varj::parse("{{ key }}", &vars)? ); ```
With a json string:
```rust let mut variables = varj::VarjMap::new(); variables.insert("name".toowned(), "Christopher".toowned()); variables.insert("age".toowned(), "30".toowned());
let json = r#"{ "name" = "{{ name }}", "age" = {{ age }} }"#;
let expected = r#"{ "name" = "Christopher", "age" = 30 }"#;
let actual = varj::parse(json, &variables)?;
assert_eq!(expected, actual); ```
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.