Function predicates::ord::lt

source ·
pub fn lt<T>(constant: T) -> OrdPredicate<T>
where T: Debug + PartialOrd,
Expand description

Creates a new predicate that will return true when the given variable is less than a pre-defined value.

§Examples

use predicates::prelude::*;

let predicate_fn = predicate::lt(5);
assert_eq!(true, predicate_fn.eval(&4));
assert_eq!(false, predicate_fn.eval(&6));

let predicate_fn = predicate::lt("b");
assert_eq!(true, predicate_fn.eval("a"));
assert_eq!(false, predicate_fn.eval("c"));

let predicate_fn = predicate::lt(String::from("b"));
assert_eq!(true, predicate_fn.eval("a"));
assert_eq!(false, predicate_fn.eval("c"));