Implement conversion from IceResult into BreadcrumbTreeNode.

I believe this change will remove an extra heap allocation I was doing in the new_breadcrumbs_* functions for the explicit context by adding support for converting from Rc<dyn ContextElement> to Rc<dyn IntoContextElement> without copying the underlying data. This should allow conversion of the IceResult::Owned variant to the BreadcrumbTreeElement::Owned variant without extra copying.
This commit is contained in:
Tom Alexander
2020-06-06 19:39:44 -04:00
parent 7253c7d99e
commit f9dea70d23
4 changed files with 31 additions and 6 deletions

View File

@@ -227,7 +227,7 @@ impl<'a> DustRenderer<'a> {
.flatten()
.map(|val| {
if val.get_context_element_reference().is_truthy() {
new_nodes.push(BreadcrumbTreeElement::Owned(Rc::new(val)))
new_nodes.push(std::convert::From::from(val))
}
});
});
@@ -297,7 +297,7 @@ impl<'a> DustRenderer<'a> {
.flatten()
.map(|val| {
if val.get_context_element_reference().is_truthy() {
new_nodes.push(BreadcrumbTreeElement::Owned(Rc::new(val)));
new_nodes.push(std::convert::From::from(val));
}
});
});