I think I need to implement iterating on the tree nodes.

master
Tom Alexander 4 years ago
parent 3f49519bea
commit 89c751e849
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

@ -18,6 +18,15 @@ where
todo!()
}
fn get_first_non_pseudo_element<'a, B>(
breadcrumbs: &'a BreadcrumbTreeNode<B>,
) -> Option<&'a dyn IntoContextElement>
where
B: IntoContextElement,
{
breadcrumbs.iter().filter(|b| b.is_pseudo_element()).next()
}
pub fn walk_path<'a, B, P>(
maybe_breadcrumbs: Option<&'a BreadcrumbTreeNode<B>>,
path: &Vec<P>,
@ -29,7 +38,13 @@ where
match (maybe_breadcrumbs, path.first()) {
(None, _) => return Err(WalkError::CantWalk),
(Some(breadcrumbs), None) => return Ok(breadcrumbs.get_ice()),
(Some(breadcrumbs), Some(path_first)) if path_first.borrow() == "." => (),
(Some(breadcrumbs), Some(path_first)) if path_first.borrow() == "." => {
let first_non_pseudo_element = get_first_non_pseudo_element(breadcrumbs);
// return match first_non_pseudo_element {
// None => Err(WalkError::CantWalk),
// Some(current_context)
// }
}
(Some(breadcrumbs), Some(path_first)) => (),
}

Loading…
Cancel
Save