From 15c8ee57a7bbf10e8b26c15584aa767d6d3c4f5e Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 11 Apr 2020 19:19:40 -0400 Subject: [PATCH] Successfully rendering my first template. --- src/bin.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/bin.rs b/src/bin.rs index 334559a..d5558f6 100644 --- a/src/bin.rs +++ b/src/bin.rs @@ -69,6 +69,13 @@ fn read_context_from_stdin() -> serde_json::map::Map impl Renderable for serde_json::Value { fn render(&self) -> String { - self.to_string() + match self { + serde_json::Value::Null => "".to_owned(), + serde_json::Value::Bool(boolean) => boolean.to_string(), + serde_json::Value::Number(num) => num.to_string(), + serde_json::Value::String(string) => string.to_string(), + serde_json::Value::Array(_arr) => panic!("Attempted to render an array"), + serde_json::Value::Object(_obj) => panic!("Attempted to render an object"), + } } }