pub fn try_all_map_keys<K, V, E>(
predicate: fn(&K) -> Result<bool, E>,
) -> impl Fn(&HashMap<K, V>) -> Result<bool, E>Expand description
Checks if all keys in the HashMap satisfy the predicate (fallible ones accepted).
#[derive(Debug, Valust)]
struct All {
#[valid(func(try(try_all_map_keys(|k: &String| k.parse::<i32>().map(|u| u > 1)))))]
data: HashMap<String, u8>
}
let all = Raw::<All> { data: vec![("1".to_owned(), 2), ("2".to_owned(), 3), ("3".to_owned(), 4)].into_iter().collect() };
let val = All::validate(all);
assert!(val.is_err());
println!("{}", val.unwrap_err().full_stringify());