Running into lifetime issues again.

This commit is contained in:
Tom Alexander
2020-05-31 23:47:20 -04:00
parent da15439946
commit 303f092c30
3 changed files with 34 additions and 28 deletions

View File

@@ -19,6 +19,7 @@ use crate::renderer::inline_partial_tree::InlinePartialTreeElement;
use crate::renderer::tree_walking::walk_path;
use std::borrow::Borrow;
use std::collections::HashMap;
use std::rc::Rc;
#[derive(Clone, Debug)]
pub struct DustRenderer<'a> {
@@ -153,8 +154,10 @@ impl<'a> DustRenderer<'a> {
match val {
Err(WalkError::CantWalk) | Ok(None) => return Ok("".to_owned()),
Ok(Some(final_val)) => {
return if final_val.is_truthy() {
final_val.render(&Self::preprocess_filters(&reference.filters))
return if final_val.get_context_element_reference().is_truthy() {
final_val
.get_context_element_reference()
.render(&Self::preprocess_filters(&reference.filters))
} else {
Ok("".to_owned())
};
@@ -223,8 +226,8 @@ impl<'a> DustRenderer<'a> {
.ok()
.flatten()
.map(|val| {
if val.is_truthy() {
new_nodes.push(BreadcrumbTreeElement::Borrowed(val.from_context_element()))
if val.get_context_element_reference().is_truthy() {
new_nodes.push(BreadcrumbTreeElement::Owned(Rc::new(val)))
}
});
});