Running into a lifetime issue

This commit is contained in:
Tom Alexander 2020-05-08 22:34:58 -04:00
parent 2f515e068d
commit efd103b84a
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -1,6 +1,10 @@
use crate::parser::KVPair; use crate::parser::KVPair;
use crate::parser::RValue; use crate::parser::{Filter, RValue};
use crate::renderer::context_element::ContextElement; use crate::renderer::context_element::ContextElement;
use crate::renderer::Loopable;
use crate::renderer::RenderError;
use crate::renderer::Renderable;
use crate::renderer::Walkable;
use std::collections::HashMap; use std::collections::HashMap;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
@ -25,4 +29,26 @@ impl<'a> ParametersContext<'a> {
} }
} }
// impl<'a> ContextElement for ParametersContext<'a> {} impl<'a> ContextElement for ParametersContext<'a> {}
impl<'a> Renderable for ParametersContext<'a> {
fn render(&self, _filters: &Vec<Filter>) -> Result<String, RenderError> {
Ok("[object Object]".to_owned())
}
}
impl<'a> Loopable for ParametersContext<'a> {
fn get_loop_elements(&self) -> Result<Vec<&dyn ContextElement>, RenderError> {
Ok(vec![self])
}
}
impl<'a> Walkable for ParametersContext<'a> {
fn walk(&self, segment: &str) -> Result<&dyn ContextElement, RenderError> {
// TODO: Actually implement
Err(RenderError::CantWalk {
segment: segment.to_string(),
elem: self,
})
}
}