Implemented the backtracing logic for walking.
This commit is contained in:
parent
6bcc66dff5
commit
a3bb8e47c1
@ -210,16 +210,27 @@ fn walk_path_from_single_level<'a>(
|
|||||||
|
|
||||||
fn new_walk_path<'a>(
|
fn new_walk_path<'a>(
|
||||||
breadcrumbs: Vec<&'a dyn ContextElement>,
|
breadcrumbs: Vec<&'a dyn ContextElement>,
|
||||||
path: &Vec<&str>,
|
path: &'a Vec<&str>,
|
||||||
) -> Result<&'a dyn ContextElement, RenderError<'a>> {
|
) -> Result<&'a dyn ContextElement, RenderError<'a>> {
|
||||||
for context in breadcrumbs.iter().rev() {
|
for context in breadcrumbs.iter().rev() {
|
||||||
match walk_path_from_single_level(*context, path)? {
|
match walk_path_from_single_level(*context, path)? {
|
||||||
|
// If no walking was done at all, keep looping
|
||||||
WalkResult::NoWalk => {}
|
WalkResult::NoWalk => {}
|
||||||
WalkResult::PartialWalk => {}
|
// If we partially walked then stop trying to find
|
||||||
WalkResult::FullyWalked(_) => {}
|
// anything
|
||||||
|
WalkResult::PartialWalk => {
|
||||||
|
return Err(RenderError::NotFound {
|
||||||
|
path: path,
|
||||||
|
breadcrumbs: breadcrumbs,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
WalkResult::FullyWalked(new_context) => return Ok(new_context),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(RenderError::Generic("temp".to_owned()))
|
Err(RenderError::NotFound {
|
||||||
|
path: path,
|
||||||
|
breadcrumbs: breadcrumbs,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: rename walk_path_from_single_level
|
// TODO: rename walk_path_from_single_level
|
||||||
|
Loading…
Reference in New Issue
Block a user