Fixed lifetime issue

This commit is contained in:
Tom Alexander 2020-05-02 16:08:39 -04:00
parent 7b87e30ff9
commit 9a261aa870
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -62,7 +62,7 @@ impl<'a> DustRenderer<'a> {
.insert(template.name.clone(), &template.template);
}
pub fn render<C>(&self, name: &str, context: &'a C) -> Result<String, RenderError<'a>>
pub fn render<C>(&'a self, name: &str, context: &'a C) -> Result<String, RenderError<'a>>
where
C: ContextElement,
{
@ -78,7 +78,7 @@ impl<'a> DustRenderer<'a> {
self.render_body(&main_template.contents, context)
}
fn render_body<C>(&self, body: &Body, context: &'a C) -> Result<String, RenderError<'a>>
fn render_body<C>(&'a self, body: &Body, context: &'a C) -> Result<String, RenderError<'a>>
where
C: ContextElement,
{
@ -94,7 +94,7 @@ impl<'a> DustRenderer<'a> {
Ok(output)
}
fn render_tag<C>(&self, tag: &DustTag, context: &'a C) -> Result<String, RenderError<'a>>
fn render_tag<C>(&'a self, tag: &DustTag, context: &'a C) -> Result<String, RenderError<'a>>
where
C: ContextElement,
{
@ -129,7 +129,7 @@ impl<'a> DustRenderer<'a> {
None => Ok("".to_owned()),
};
} else {
match container.contents {
match &container.contents {
None => return Ok("".to_owned()),
Some(body) => {
let rendered_results: Result<Vec<String>, RenderError> =