Skip to content

Commit

Permalink
drop EvalStrict
Browse files Browse the repository at this point in the history
  • Loading branch information
ssddOnTop committed Nov 29, 2024
1 parent 3974f81 commit f01035f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
28 changes: 0 additions & 28 deletions src/core/mustache/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ pub trait Eval<'a> {
fn eval(&'a self, mustache: &'a Mustache, in_value: &'a Self::In) -> Self::Out;
}

pub trait EvalStrict<'a> {
type In;
type Out;

fn eval_strict(&'a self, mustache: &'a Mustache, in_value: &'a Self::In) -> Self::Out;
}

pub struct PathStringEval<A>(std::marker::PhantomData<A>);

impl<A> PathStringEval<A> {
Expand Down Expand Up @@ -42,27 +35,6 @@ impl<A: PathString> Eval<'_> for PathStringEval<A> {
}
}

impl<A: PathString> EvalStrict<'_> for PathStringEval<A> {
type In = A;
type Out = String;

fn eval_strict(&'_ self, mustache: &'_ Mustache, in_value: &'_ Self::In) -> Self::Out {
mustache
.segments()
.iter()
.map(|segment| match segment {
Segment::Literal(text) => text.to_string(),
Segment::Expression(parts) => in_value
.path_string(parts)
.map(|v| v.to_string())
.unwrap_or(
Mustache::from(vec![Segment::Expression(parts.to_vec())]).to_string(),
),
})
.collect()
}
}

pub trait Path {
fn get_path<S: AsRef<str>>(&self, in_value: &[S]) -> Option<&Self>;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/mustache/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod eval;
mod model;
mod parse;
pub use eval::{Eval, EvalStrict};
pub use eval::Eval;
pub use model::*;

0 comments on commit f01035f

Please sign in to comment.