Implement a SelectContext for passing the select parameters and whether or not any comparison passed down exactly 1 level in the renderer.
This commit is contained in:
parent
b0b857147d
commit
576d94780a
@ -13,7 +13,6 @@ pub trait ContextElement:
|
||||
+ Walkable
|
||||
+ Renderable
|
||||
+ Loopable
|
||||
// + CloneIntoBoxedContextElement
|
||||
+ CompareContextElement
|
||||
+ FromContextElement
|
||||
+ IntoRcIce
|
||||
@ -64,16 +63,6 @@ pub trait CompareContextElement: CastToAny {
|
||||
fn partial_compare(&self, other: &dyn ContextElement) -> Option<Ordering>;
|
||||
}
|
||||
|
||||
// pub trait CloneIntoBoxedContextElement {
|
||||
// fn clone_to_box(&self) -> Box<dyn IntoContextElement>;
|
||||
// }
|
||||
|
||||
// impl<C: 'static + IntoContextElement + Clone> CloneIntoBoxedContextElement for C {
|
||||
// fn clone_to_box(&self) -> Box<dyn IntoContextElement> {
|
||||
// Box::new(self.clone())
|
||||
// }
|
||||
// }
|
||||
|
||||
impl<C: 'static + ContextElement> CastToAny for C {
|
||||
fn to_any(&self) -> &dyn Any {
|
||||
self
|
||||
|
@ -7,9 +7,9 @@ mod inline_partial_tree;
|
||||
mod iteration_context;
|
||||
mod parameters_context;
|
||||
mod renderer;
|
||||
mod select_context;
|
||||
mod walking;
|
||||
|
||||
// pub use context_element::CloneIntoBoxedContextElement;
|
||||
pub use context_element::CompareContextElement;
|
||||
pub use context_element::ContextElement;
|
||||
pub use context_element::IntoContextElement;
|
||||
@ -21,5 +21,5 @@ pub use errors::CompileError;
|
||||
pub use errors::RenderError;
|
||||
pub use errors::WalkError;
|
||||
pub use renderer::compile_template;
|
||||
// pub use renderer::CompiledTemplate;
|
||||
pub use renderer::DustRenderer;
|
||||
pub use select_context::SelectContext;
|
||||
|
16
src/renderer/select_context.rs
Normal file
16
src/renderer/select_context.rs
Normal file
@ -0,0 +1,16 @@
|
||||
use crate::renderer::parameters_context::ParametersContext;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SelectContext<'a> {
|
||||
select_parameters: &'a ParametersContext<'a>,
|
||||
were_any_true: bool,
|
||||
}
|
||||
|
||||
impl<'a> SelectContext<'a> {
|
||||
pub fn new(select_parameters: &'a ParametersContext<'a>, were_any_true: bool) -> Self {
|
||||
SelectContext {
|
||||
select_parameters: select_parameters,
|
||||
were_any_true: were_any_true,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user