tentatively seems to be working.

This commit is contained in:
Tom Alexander
2020-05-10 19:16:55 -04:00
parent c96b2257d7
commit 8fd2a9cf39
5 changed files with 37 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
extern crate nom;
use crate::renderer::CompareContextElement;
use crate::renderer::IntoBoxedContextElement;
use parser::Filter;
use renderer::compile_template;
@@ -11,6 +12,7 @@ use renderer::RenderError;
use renderer::Renderable;
use renderer::WalkError;
use renderer::Walkable;
use std::any::Any;
use std::env;
use std::fs;
use std::io::{self, Read};
@@ -144,3 +146,16 @@ impl IntoBoxedContextElement for serde_json::Value {
Box::new(self.clone())
}
}
impl CompareContextElement for serde_json::Value {
fn to_any(&self) -> &dyn Any {
self
}
fn equals(&self, other: &dyn ContextElement) -> bool {
other
.to_any()
.downcast_ref::<Self>()
.map_or(false, |a| self == a)
}
}