predicate

Function predicate 

Source
pub fn predicate<P>(
    predicate: P,
) -> JsonPredicateMatcher<P, NoDescription, NoDescription>
where P: Fn(&Value) -> bool,
Expand description

Builds a JSON matcher from an arbitrary predicate function.

ยงExamples

let positive = json::predicate(|v| v.as_i64().is_some_and(|n| n > 0));
verify_that!(j!(42), &positive);
assert_that!(j!(-1), not(&positive));