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>(
|
fn new_breadcrumbs_section<'b>(
|
||||||
&'b self,
|
&'b self,
|
||||||
maybe_breadcrumbs: &'b Vec<BreadcrumbTreeElement<'b>>,
|
breadcrumbs: &'b Vec<BreadcrumbTreeElement<'b>>,
|
||||||
index_context: Option<&'b dyn IntoContextElement>,
|
index_context: Option<&'b dyn IntoContextElement>,
|
||||||
injected_context: Option<&'b dyn IntoContextElement>,
|
injected_context: Option<&'b dyn IntoContextElement>,
|
||||||
explicit_context: &Option<Path<'b>>,
|
explicit_context: &Option<Path<'b>>,
|
||||||
new_context_element: Option<&'b dyn ContextElement>,
|
new_context_element: Option<&'b dyn ContextElement>,
|
||||||
) {
|
) -> Option<Vec<BreadcrumbTreeElement<'b>>> {
|
||||||
/*
|
|
||||||
// If none of the additional contexts are present, return None
|
// If none of the additional contexts are present, return None
|
||||||
// to signal that the original breadcrumbs should be used
|
// to signal that the original breadcrumbs should be used
|
||||||
// rather than incurring a copy here.
|
// 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
|
// If there is an explicit context, then drop all the current
|
||||||
// context
|
// context
|
||||||
let parent = match explicit_context {
|
let mut new_stack = match explicit_context {
|
||||||
Some(_) => None,
|
Some(_) => Vec::with_capacity(4),
|
||||||
None => maybe_breadcrumbs,
|
None => breadcrumbs.clone(),
|
||||||
};
|
};
|
||||||
let mut new_nodes: Vec<BreadcrumbTreeElement> = Vec::new();
|
|
||||||
|
|
||||||
explicit_context.as_ref().map(|path| {
|
explicit_context.as_ref().map(|path| {
|
||||||
walk_path(maybe_breadcrumbs, &path.keys)
|
walk_path(breadcrumbs, &path.keys)
|
||||||
.map(|ice| ice.into_context_element(self, maybe_breadcrumbs))
|
.map(|ice| ice.into_context_element(self, breadcrumbs))
|
||||||
.ok()
|
.ok()
|
||||||
.flatten()
|
.flatten()
|
||||||
.map(|val| {
|
.map(|val| {
|
||||||
if val.get_context_element_reference().is_truthy() {
|
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_context_element.map(|ctx| {
|
||||||
new_nodes.push(BreadcrumbTreeElement::from_borrowed(
|
new_stack.push(BreadcrumbTreeElement::from_borrowed(
|
||||||
ctx.from_context_element(),
|
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))
|
Some(new_stack)
|
||||||
*/
|
|
||||||
todo!()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_breadcrumbs_partial<'b>(
|
fn new_breadcrumbs_partial<'b>(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user