diff --git a/src/renderer/walking.rs b/src/renderer/walking.rs index 942db87..cc91047 100644 --- a/src/renderer/walking.rs +++ b/src/renderer/walking.rs @@ -53,9 +53,21 @@ pub fn walk_path<'a>( } pub fn owned_walk_path<'a>( - breadcrumbs: &Vec>, + breadcrumbs: &'a Vec>, path: &Vec, ) -> Result<&'a dyn ContextElement, WalkError> { - // TODO: Implement owned_walk_path + let path_reference: Vec<&str> = path.iter().map(|p| &p[..]).collect(); + for context in breadcrumbs.iter().rev() { + match walk_path_from_single_level(context.as_ref(), &path_reference) { + // If no walking was done at all, keep looping + WalkResult::NoWalk => {} + // If we partially walked then stop trying to find + // anything + WalkResult::PartialWalk => { + return Err(WalkError::CantWalk); + } + WalkResult::FullyWalked(new_context) => return Ok(new_context), + } + } Err(WalkError::CantWalk) }