predicates::constant

Function always

Source
pub fn always() -> BooleanPredicate
Expand description

Creates a new Predicate that always returns true.

ยงExamples

use predicates::prelude::*;

let predicate_fn = predicate::always();
assert_eq!(true, predicate_fn.eval(&5));
assert_eq!(true, predicate_fn.eval(&10));
assert_eq!(true, predicate_fn.eval(&15));
// Won't work - Predicates can only operate on a single type
// assert_eq!(true, predicate_fn.eval("hello"))