Function not

Source
pub const fn not(cond: impl Fn(Vector) -> Vector) -> impl Fn(Vector) -> Vector
Expand description

Negate a condition

§Arguments

  • cond - The condition to negate

§Example

use swift_check::{ensure, range, not, arch::load};

let input = b"abcdefghijklmnop";
let data = load(input);

let no_numbers = ensure!(data, not(range!(b'0'..=b'9')));
assert!(no_numbers);

let input = b"abcdefghijklmno1";
let data = load(input);

let should_fail = ensure!(data, not(range!(b'0'..=b'9')));
assert!(!should_fail);