macro_rules! all_of {
    ( {$($lh_sides:expr),+ $(,)?}.satisfy($($func:tt)+) ) => { ... };
    ( {$($lh_sides:expr),+ $(,)?}.map($($func:tt)+) $operator:tt $rhs:expr) => { ... };
    ( {$($lh_sides:expr),+ $(,)?} $operator:tt $rhs:expr) => { ... };
}
Expand description

Compare all values in a set to a common right hand side and decide whether the comparison returns true for all of the values in the set.

Usage

The usage is analogous to the any_of macro and is documented in more detail there. Just like any_of, this macro also performs lazy evaluation.

Examples

The following examples show how to use the macro.


let square = |val|val*val;
// the following assertion holds
assert!(all_of!({4+4+1,square(7*2),120_i32.pow(2)}>0));

let v = vec![1, 2,3,4,5];
// the following assertion holds
assert!(all_of!( {square(2),v.len() as i32,2,1+1,"hello".len() as i32} <= v.len() as i32));