Slight progress on new_breadcrumbs_section.
This commit is contained in:
parent
2b532e7eb4
commit
b381789422
@ -18,6 +18,16 @@ pub enum BreadcrumbTreeNodeElement<'a> {
|
||||
}
|
||||
|
||||
impl<'a> BreadcrumbTreeNode<'a> {
|
||||
pub fn new(
|
||||
parent: Option<&'a dyn BreadcrumbTree>,
|
||||
element: BreadcrumbTreeNodeElement<'a>,
|
||||
) -> Self {
|
||||
BreadcrumbTreeNode {
|
||||
parent: parent,
|
||||
element: element,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ice_iter(&'a self) -> impl Iterator<Item = &dyn IntoContextElement> {
|
||||
self.breadcrumb_iter().map(|b| b.get_ice())
|
||||
}
|
||||
|
@ -44,44 +44,42 @@ impl<'a> DustRenderer<'a> {
|
||||
.insert(template.name.clone(), &template.template);
|
||||
}
|
||||
|
||||
// fn new_breadcrumbs_section<'b, B>(
|
||||
// &self,
|
||||
// maybe_breadcrumbs: Option<&'a BreadcrumbTreeNode<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<&'a BreadcrumbTreeNode<B>>
|
||||
// where
|
||||
// B: IntoContextElement,
|
||||
// {
|
||||
// // If there is no new content, return the original breadcrumbs
|
||||
// match (
|
||||
// index_context,
|
||||
// injected_context,
|
||||
// explicit_context,
|
||||
// new_context_element,
|
||||
// ) {
|
||||
// (None, None, None, None) => return maybe_breadcrumbs,
|
||||
// _ => (),
|
||||
// }
|
||||
fn new_breadcrumbs_section<'b>(
|
||||
&self,
|
||||
maybe_breadcrumbs: Option<&'a BreadcrumbTreeNode>,
|
||||
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<&'a BreadcrumbTreeNode> {
|
||||
// If there is no new content, return the original breadcrumbs
|
||||
match (
|
||||
index_context,
|
||||
injected_context,
|
||||
explicit_context,
|
||||
new_context_element,
|
||||
) {
|
||||
(None, None, None, None) => return maybe_breadcrumbs,
|
||||
_ => (),
|
||||
}
|
||||
|
||||
// // If there is an explicit context, then drop all the current
|
||||
// // context
|
||||
// let mut new_stack = match explicit_context {
|
||||
// Some(_) => None,
|
||||
// None => maybe_breadcrumbs,
|
||||
// };
|
||||
// If there is an explicit context, then drop all the current
|
||||
// context
|
||||
let mut parent = match explicit_context {
|
||||
Some(_) => None,
|
||||
None => maybe_breadcrumbs,
|
||||
};
|
||||
let mut new_stack = None;
|
||||
|
||||
// // TODO: Explicit context
|
||||
// // injected_context.map(|ctx| {
|
||||
// // new_stack = Some(BreadcrumbTreeNode {
|
||||
// // parent: new_stack.map(|b| b as _),
|
||||
// // element: BreadcrumbTreeNodeElement::Borrowed(ctx),
|
||||
// // });
|
||||
// // // TODO
|
||||
// // });
|
||||
// TODO: Explicit context
|
||||
|
||||
// None
|
||||
// }
|
||||
injected_context.map(|ctx| {
|
||||
new_stack = Some(BreadcrumbTreeNode::new(
|
||||
parent.map(|b| b as _),
|
||||
BreadcrumbTreeNodeElement::Borrowed(ctx),
|
||||
))
|
||||
});
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user