Macro swift_check::any
source · macro_rules! any { ($left:expr $(,)?) => { ... }; ($left:expr, $right:expr $(,)?) => { ... }; ($left:expr, $right:expr, $($rest:expr),+ $(,)?) => { ... }; }
Expand description
Check that any of the conditions hold
This is practically or
, just can handle any number of conditions
§Arguments
conditions
- The conditions where at least one must hold
§Example
use swift_check::{ensure, any, eq, arch::load};
let input = b"3333333377777777";
let data = load(input);
let three_or_seven = ensure!(data, any!(eq(b'3'), eq(b'7')));
assert!(three_or_seven);
let input = b"3333333557777777";
let data = load(input);
let should_fail = ensure!(data, any!(eq(b'3'), eq(b'7')));
assert!(!should_fail);