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:
@@ -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));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user