Remove iteration_context, parameters_context, and most of bin.rs.

Since I'm changing a pretty core concept of the renderer, I'm going to be rebuilding it piece by piece. In the interest of being able to rapidly change things and check if they are valid through compilation, I need to eliminate most of the old code so I do not have that weighing me down.
This commit is contained in:
Tom Alexander
2020-05-31 18:27:55 -04:00
parent acb8dfb58e
commit b8b4759d45
4 changed files with 283 additions and 282 deletions

View File

@@ -1,4 +1,5 @@
use crate::parser::Filter;
use crate::renderer::breadcrumb_tree::BreadcrumbTree;
use crate::renderer::errors::RenderError;
use crate::renderer::errors::WalkError;
use crate::renderer::DustRenderer;
@@ -103,7 +104,7 @@ pub trait IntoContextElement: Debug + Walkable + CloneIntoBoxedContextElement {
fn into_context_element(
&self,
renderer: &DustRenderer,
breadcrumbs: &Vec<&dyn IntoContextElement>,
breadcrumbs: Option<&BreadcrumbTree>,
) -> &dyn ContextElement;
}
@@ -111,7 +112,7 @@ impl<C: ContextElement> IntoContextElement for C {
fn into_context_element(
&self,
renderer: &DustRenderer,
breadcrumbs: &Vec<&dyn IntoContextElement>,
breadcrumbs: Option<&BreadcrumbTree>,
) -> &dyn ContextElement {
self
}

View File

@@ -4,8 +4,8 @@ mod breadcrumb_tree;
mod context_element;
mod errors;
mod inline_partial_tree;
mod iteration_context;
mod parameters_context;
// mod iteration_context;
// mod parameters_context;
mod renderer;
mod tree_walking;
mod walking;

View File

@@ -80,17 +80,17 @@ impl<'a> DustRenderer<'a> {
Some(_) => None,
None => maybe_breadcrumbs,
};
let mut new_nodes = Vec::new();
let mut new_nodes: Vec<BreadcrumbTreeElement> = Vec::new();
// explicit_context.as_ref().map(|path| {
// let x = walk_path(maybe_breadcrumbs, &path.keys);
// x.map(|ice| ice.into_context_element(self, breadcrumbs))
// .map(|val| {
// if val.is_truthy() {
// new_nodes.push(val.from_context_element())
// }
// });
// });
explicit_context.as_ref().map(|path| {
let x = walk_path(maybe_breadcrumbs, &path.keys);
x.map(|ice| ice.into_context_element(self, maybe_breadcrumbs))
.map(|val| {
if val.is_truthy() {
new_nodes.push(BreadcrumbTreeElement::Borrowed(val.from_context_element()))
}
});
});
injected_context.map(|ctx| new_nodes.push(BreadcrumbTreeElement::Borrowed(ctx)));
new_context_element
.map(|ctx| new_nodes.push(BreadcrumbTreeElement::Borrowed(ctx.from_context_element())));