predicates::constant

Function never

Source
pub fn never() -> BooleanPredicate
Expand description

Creates a new Predicate that always returns false.

ยงExamples

use predicates::prelude::*;

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