Worked around a lifetime issue with into_context_element.
This commit is contained in:
parent
b74dc394a8
commit
064027e77b
@ -101,19 +101,19 @@ impl<C: ContextElement> FromContextElement for C {
|
||||
}
|
||||
|
||||
pub trait IntoContextElement: Debug + Walkable /* + CloneIntoBoxedContextElement*/ {
|
||||
fn into_context_element(
|
||||
&self,
|
||||
fn into_context_element<'a>(
|
||||
&'a self,
|
||||
renderer: &DustRenderer,
|
||||
breadcrumbs: Option<&BreadcrumbTree>,
|
||||
) -> Option<&dyn ContextElement>;
|
||||
breadcrumbs: Option<&'a BreadcrumbTree<'a>>,
|
||||
) -> Option<&'a dyn ContextElement>;
|
||||
}
|
||||
|
||||
impl<C: ContextElement> IntoContextElement for C {
|
||||
fn into_context_element(
|
||||
&self,
|
||||
fn into_context_element<'a>(
|
||||
&'a self,
|
||||
renderer: &DustRenderer,
|
||||
breadcrumbs: Option<&BreadcrumbTree>,
|
||||
) -> Option<&dyn ContextElement> {
|
||||
breadcrumbs: Option<&'a BreadcrumbTree<'a>>,
|
||||
) -> Option<&'a dyn ContextElement> {
|
||||
Some(self)
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ use crate::renderer::breadcrumb_tree::BreadcrumbTree;
|
||||
use crate::renderer::context_element::CompareContextElement;
|
||||
use crate::renderer::context_element::ContextElement;
|
||||
use crate::renderer::context_element::IntoContextElement;
|
||||
use crate::renderer::tree_walking::walk_path;
|
||||
use crate::renderer::DustRenderer;
|
||||
use crate::renderer::Loopable;
|
||||
use crate::renderer::RenderError;
|
||||
@ -32,16 +33,20 @@ impl<'a> ParametersContext<'a> {
|
||||
}
|
||||
|
||||
impl<'a> IntoContextElement for RValue<'a> {
|
||||
fn into_context_element(
|
||||
&self,
|
||||
fn into_context_element<'b>(
|
||||
&'b self,
|
||||
renderer: &DustRenderer,
|
||||
breadcrumbs: Option<&BreadcrumbTree>,
|
||||
) -> Option<&dyn ContextElement> {
|
||||
breadcrumbs: Option<&'b BreadcrumbTree<'b>>,
|
||||
) -> Option<&'b dyn ContextElement> {
|
||||
match self {
|
||||
RValue::RVLiteral(owned_literal) => Some(owned_literal),
|
||||
RValue::RVPath(path) => todo!(),
|
||||
RValue::RVPath(path) => walk_path(breadcrumbs, &path.keys)
|
||||
.map(|ice| ice.into_context_element(renderer, breadcrumbs))
|
||||
.ok()
|
||||
.flatten(),
|
||||
RValue::RVTemplate(template) => todo!(),
|
||||
}
|
||||
// todo!()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user