The structure is all there, just need to implement owned_walk_path and clone on NewParametersContext.
This commit is contained in:
parent
4e274b9ea5
commit
dade738f55
@ -3,6 +3,7 @@ use crate::parser::{Filter, RValue};
|
|||||||
use crate::renderer::context_element::CloneIntoBoxedContextElement;
|
use crate::renderer::context_element::CloneIntoBoxedContextElement;
|
||||||
use crate::renderer::context_element::CompareContextElement;
|
use crate::renderer::context_element::CompareContextElement;
|
||||||
use crate::renderer::context_element::ContextElement;
|
use crate::renderer::context_element::ContextElement;
|
||||||
|
use crate::renderer::walking::owned_walk_path;
|
||||||
use crate::renderer::walking::walk_path;
|
use crate::renderer::walking::walk_path;
|
||||||
use crate::renderer::Loopable;
|
use crate::renderer::Loopable;
|
||||||
use crate::renderer::RenderError;
|
use crate::renderer::RenderError;
|
||||||
@ -94,7 +95,7 @@ impl Walkable for NewParametersContext {
|
|||||||
fn walk(&self, segment: &str) -> Result<&dyn ContextElement, WalkError> {
|
fn walk(&self, segment: &str) -> Result<&dyn ContextElement, WalkError> {
|
||||||
let rval = self.params.get(segment).ok_or(WalkError::CantWalk)?;
|
let rval = self.params.get(segment).ok_or(WalkError::CantWalk)?;
|
||||||
match rval {
|
match rval {
|
||||||
OwnedRValue::RVPath(path) => walk_path(self.breadcrumbs, &path.keys),
|
OwnedRValue::RVPath(path) => owned_walk_path(&self.breadcrumbs, &path.keys),
|
||||||
OwnedRValue::RVString(text) => Ok(text),
|
OwnedRValue::RVString(text) => Ok(text),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,8 +103,11 @@ impl Walkable for NewParametersContext {
|
|||||||
|
|
||||||
impl Clone for NewParametersContext {
|
impl Clone for NewParametersContext {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
// TODO: What is this doing, really?
|
// TODO: Implement clone
|
||||||
*self
|
NewParametersContext {
|
||||||
|
params: HashMap::new(),
|
||||||
|
breadcrumbs: Vec::new(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,3 +51,11 @@ pub fn walk_path<'a>(
|
|||||||
}
|
}
|
||||||
Err(WalkError::CantWalk)
|
Err(WalkError::CantWalk)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn owned_walk_path<'a>(
|
||||||
|
breadcrumbs: &Vec<Box<dyn ContextElement>>,
|
||||||
|
path: &Vec<String>,
|
||||||
|
) -> Result<&'a dyn ContextElement, WalkError> {
|
||||||
|
// TODO: Implement owned_walk_path
|
||||||
|
Err(WalkError::CantWalk)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user