Successfully rendering my first template.

This commit is contained in:
Tom Alexander 2020-04-11 19:19:40 -04:00
parent e26b158ab4
commit 15c8ee57a7
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 8 additions and 1 deletions

View File

@ -69,6 +69,13 @@ fn read_context_from_stdin() -> serde_json::map::Map<String, serde_json::Value>
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"),
}
}
}