I think I have solved the lifetime issue.

OwnedBreadcrumbTreeElement's needed a lifetime associated with them because IntoContextElement had lifetimes associated with it.
master
Tom Alexander 4 years ago
parent adbc236836
commit e725728a65
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

@ -13,7 +13,7 @@ pub enum BreadcrumbTreeElement<'a> {
// the same BreadcrumbTreeElement but a different parent (for
// example, when inserting behind the tail), we don't need to the
// copy the already owned/malloc'd data.
Owned(Rc<dyn IntoContextElement>),
Owned(Rc<dyn IntoContextElement + 'a>),
Borrowed(&'a dyn IntoContextElement),
}

@ -220,14 +220,7 @@ impl<'a> DustRenderer<'a> {
};
let mut new_nodes: Vec<BreadcrumbTreeElement> = Vec::new();
let p = explicit_context.as_ref().unwrap();
let x = walk_path(maybe_breadcrumbs, &p.keys);
let ice = x.unwrap();
let ce = ice.into_context_element(self, maybe_breadcrumbs);
let val = ce.unwrap();
let to_insert = BreadcrumbTreeElement::Owned(Rc::new(val));
//new_nodes.push(BreadcrumbTreeElement::Owned(Rc::new(val)));
/*explicit_context.as_ref().map(|path| {
explicit_context.as_ref().map(|path| {
walk_path(maybe_breadcrumbs, &path.keys)
.map(|ice| ice.into_context_element(self, maybe_breadcrumbs))
.ok()
@ -237,7 +230,7 @@ impl<'a> DustRenderer<'a> {
new_nodes.push(BreadcrumbTreeElement::Owned(Rc::new(val)))
}
});
});*/
});
injected_context.map(|ctx| new_nodes.push(BreadcrumbTreeElement::Borrowed(ctx)));
new_context_element
.map(|ctx| new_nodes.push(BreadcrumbTreeElement::Borrowed(ctx.from_context_element())));
@ -294,7 +287,7 @@ impl<'a> DustRenderer<'a> {
_ => new_nodes.push(BreadcrumbTreeElement::Borrowed(ctx)),
}
});
/*explicit_context.as_ref().map(|path| {
explicit_context.as_ref().map(|path| {
// TODO: should resolving the value here use
// explicit_context_maybe_breadcrumbs or
// maybe_breadcrumbs?
@ -307,7 +300,7 @@ impl<'a> DustRenderer<'a> {
new_nodes.push(BreadcrumbTreeElement::Owned(Rc::new(val)));
}
});
});*/
});
Some((parent, new_nodes))
}

Loading…
Cancel
Save