satisfies

Function satisfies 

Source
pub fn satisfies<F>(predicate: F) -> Predicate<F>
Expand description

Creates a Predicate expectation from a predicate function.

The failure message will contain a generic description of the expectation. To specify a custom description for the expectation, use the method Predicate::with_message on the newly constructed expectation.

ยงExamples

use asserting::expectations::satisfies;
use asserting::prelude::*;

fn is_odd(number: &i32) -> bool {
    *number & 1 == 1
}

// with a generic description
assert_that!(5).expecting(satisfies(is_odd));

// with a custom description
assert_that!(5).expecting(
    satisfies(is_odd).with_message("my number to be odd")
);