Trait json_predicate::PredicateImpl
source · pub trait PredicateImpl {
// Required method
fn evaluate(
&self,
data: &Value,
ctx: PredicateContext
) -> Result<bool, PredicateError>;
// Provided method
fn test(&self, data: &Value, ctx: PredicateContext) -> bool { ... }
}
Required Methods§
sourcefn evaluate(
&self,
data: &Value,
ctx: PredicateContext
) -> Result<bool, PredicateError>
fn evaluate( &self, data: &Value, ctx: PredicateContext ) -> Result<bool, PredicateError>
Evaluate the predicate against the provided JSON
The error result means the predicate couldn’t be evaluated properly so you have to assume it’s a false result and you’ll also have more information about why it didn’t validate.
Provided Methods§
sourcefn test(&self, data: &Value, ctx: PredicateContext) -> bool
fn test(&self, data: &Value, ctx: PredicateContext) -> bool
Evaluate the predicate against the provided JSON