Rendering my first template with actually following paths.

Before I was hard-coding the path to the reference. Now I am following the full path programmatically using the new ContextElement and Walkable traits.
This commit is contained in:
Tom Alexander
2020-04-11 22:52:20 -04:00
parent e5e1703fab
commit 273f6204d8
3 changed files with 9 additions and 12 deletions

View File

@@ -56,7 +56,7 @@ fn template_from_file<'a>(file_path: &str, file_contents: &'a str) -> CompiledTe
.expect("Failed to compile template")
}
fn read_context_from_stdin() -> serde_json::map::Map<String, serde_json::Value> {
fn read_context_from_stdin() -> serde_json::Value {
let mut buffer = String::new();
io::stdin()
.read_to_string(&mut buffer)
@@ -64,7 +64,7 @@ fn read_context_from_stdin() -> serde_json::map::Map<String, serde_json::Value>
let parsed: serde_json::Value = serde_json::from_str(&buffer).expect("Failed to parse json");
match parsed {
serde_json::Value::Object(obj) => obj,
serde_json::Value::Object(obj) => serde_json::value::Value::Object(obj),
_ => panic!("Expected context to be an object"),
}
}