Cleaning up.

This commit is contained in:
Tom Alexander 2020-05-10 22:20:39 -04:00
parent 6261f7881c
commit 75ba35a422
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 0 additions and 65 deletions

View File

@ -54,19 +54,6 @@ impl<C: 'static + ContextElement> CastToAny for C {
}
}
// impl<C: 'static + ContextElement + PartialEq> CompareContextElement for C {
// 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)
// }
// }
impl<'a, 'b> PartialEq<&'b dyn ContextElement> for &'a dyn ContextElement {
fn eq(&self, other: &&'b dyn ContextElement) -> bool {
self.equals(*other)

View File

@ -119,58 +119,6 @@ impl CompareContextElement for NewParametersContext {
}
}
// #[derive(Clone, Debug)]
// pub struct ParametersContext<'a> {
// params: HashMap<&'a str, &'a RValue<'a>>,
// breadcrumbs: &'a Vec<&'a dyn ContextElement>,
// }
// impl<'a> ParametersContext<'a> {
// pub fn new(
// breadcrumbs: &'a Vec<&'a dyn ContextElement>,
// params: &'a Vec<KVPair<'a>>,
// ) -> ParametersContext<'a> {
// let param_map = params
// .iter()
// .map(|pair: &KVPair<'a>| (pair.key, &pair.value))
// .collect();
// ParametersContext {
// params: param_map,
// breadcrumbs: breadcrumbs,
// }
// }
// }
// impl<'a> ContextElement for ParametersContext<'a> {}
// impl<'a> Renderable for ParametersContext<'a> {
// fn render(&self, _filters: &Vec<Filter>) -> Result<String, RenderError> {
// // TODO: Would this even ever be called? Won't matter, but I'd
// // like to know. Since it is injected 1 above the current
// // context, we wouldn't be able to access it with `{.}`.
// Ok("[object Object]".to_owned())
// }
// }
// impl<'a> Loopable for ParametersContext<'a> {
// fn get_loop_elements(&self) -> Vec<&dyn ContextElement> {
// // TODO: Would this even ever be called? Won't matter, but I'd
// // like to know. Since it is injected 1 above the current
// // context, we wouldn't be able to access it with `{.}`.
// vec![self]
// }
// }
// impl<'a> Walkable for ParametersContext<'a> {
// fn walk(&self, segment: &str) -> Result<&dyn ContextElement, WalkError> {
// let rval = self.params.get(segment).ok_or(WalkError::CantWalk)?;
// match rval {
// RValue::RVPath(path) => walk_path(self.breadcrumbs, &path.keys),
// RValue::RVString(text) => Ok(text),
// }
// }
// }
impl ContextElement for String {}
impl Renderable for String {