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:
@@ -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"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user