pub trait Matcher<T: Matchable> {
// Required methods
fn matches(&self, value: &T) -> bool;
fn mode(&self) -> ConditionMode;
}Expand description
Core trait for any type that can match against a value.
This is the primary interface users interact with. Both RuleMatcher
and JsonMatcher implement this trait.
§Example
use condition_matcher::{Matcher, MatcherBuilder};
let matcher = MatcherBuilder::<i32>::new()
.value_equals(42)
.build();
assert!(matcher.matches(&42));
assert!(!matcher.matches(&41));Required Methods§
Sourcefn mode(&self) -> ConditionMode
fn mode(&self) -> ConditionMode
Get the logical combination mode (AND, OR, XOR).