Fixed new_breadcrumbs_section for the Vec based breadcrumbs.
This commit is contained in:
parent
256dcd03c5
commit
b0efe50410
@ -192,13 +192,12 @@ impl<'a> DustRenderer<'a> {
|
||||
|
||||
fn new_breadcrumbs_section<'b>(
|
||||
&'b self,
|
||||
maybe_breadcrumbs: &'b Vec<BreadcrumbTreeElement<'b>>,
|
||||
breadcrumbs: &'b Vec<BreadcrumbTreeElement<'b>>,
|
||||
index_context: Option<&'b dyn IntoContextElement>,
|
||||
injected_context: Option<&'b dyn IntoContextElement>,
|
||||
explicit_context: &Option<Path<'b>>,
|
||||
new_context_element: Option<&'b dyn ContextElement>,
|
||||
) {
|
||||
/*
|
||||
) -> Option<Vec<BreadcrumbTreeElement<'b>>> {
|
||||
// If none of the additional contexts are present, return None
|
||||
// to signal that the original breadcrumbs should be used
|
||||
// rather than incurring a copy here.
|
||||
@ -214,34 +213,31 @@ impl<'a> DustRenderer<'a> {
|
||||
|
||||
// If there is an explicit context, then drop all the current
|
||||
// context
|
||||
let parent = match explicit_context {
|
||||
Some(_) => None,
|
||||
None => maybe_breadcrumbs,
|
||||
let mut new_stack = match explicit_context {
|
||||
Some(_) => Vec::with_capacity(4),
|
||||
None => breadcrumbs.clone(),
|
||||
};
|
||||
let mut new_nodes: Vec<BreadcrumbTreeElement> = Vec::new();
|
||||
|
||||
explicit_context.as_ref().map(|path| {
|
||||
walk_path(maybe_breadcrumbs, &path.keys)
|
||||
.map(|ice| ice.into_context_element(self, maybe_breadcrumbs))
|
||||
walk_path(breadcrumbs, &path.keys)
|
||||
.map(|ice| ice.into_context_element(self, breadcrumbs))
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|val| {
|
||||
if val.get_context_element_reference().is_truthy() {
|
||||
new_nodes.push(std::convert::From::from(val))
|
||||
new_stack.push(std::convert::From::from(val))
|
||||
}
|
||||
});
|
||||
});
|
||||
injected_context.map(|ctx| new_nodes.push(BreadcrumbTreeElement::from_borrowed(ctx)));
|
||||
injected_context.map(|ctx| new_stack.push(BreadcrumbTreeElement::from_borrowed(ctx)));
|
||||
new_context_element.map(|ctx| {
|
||||
new_nodes.push(BreadcrumbTreeElement::from_borrowed(
|
||||
new_stack.push(BreadcrumbTreeElement::from_borrowed(
|
||||
ctx.from_context_element(),
|
||||
))
|
||||
});
|
||||
index_context.map(|ctx| new_nodes.push(BreadcrumbTreeElement::from_borrowed(ctx)));
|
||||
index_context.map(|ctx| new_stack.push(BreadcrumbTreeElement::from_borrowed(ctx)));
|
||||
|
||||
Some((parent, new_nodes))
|
||||
*/
|
||||
todo!()
|
||||
Some(new_stack)
|
||||
}
|
||||
|
||||
fn new_breadcrumbs_partial<'b>(
|
||||
|
Loading…
x
Reference in New Issue
Block a user