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>(
|
||||
breadcrumbs: Vec<&'a dyn ContextElement>,
|
||||
path: &Vec<&str>,
|
||||
path: &'a Vec<&str>,
|
||||
) -> Result<&'a dyn ContextElement, RenderError<'a>> {
|
||||
for context in breadcrumbs.iter().rev() {
|
||||
match walk_path_from_single_level(*context, path)? {
|
||||
// If no walking was done at all, keep looping
|
||||
WalkResult::NoWalk => {}
|
||||
WalkResult::PartialWalk => {}
|
||||
WalkResult::FullyWalked(_) => {}
|
||||
// If we partially walked then stop trying to find
|
||||
// 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user