all_vec

Function all_vec 

Source
pub fn all_vec<I>(predicate: fn(&I) -> bool) -> impl Fn(&Vec<I>) -> bool
Expand description

Checks if all elements in the Vec satisfy the predicate.

#[derive(Debug, Valust)]
struct All {
    #[valid(func(all_vec(|&x| x > 1)))]
    data: Vec<u8>
}

let all = Raw::<All> { data: vec![1, 2, 3] };
let val = All::validate(all);
assert!(val.is_err());
println!("{}", val.unwrap_err().full_stringify());