rustbasic_core/support/validator.rs
1use crate::validator::Validate;
2use std::collections::HashMap;
3
4pub struct Validator;
5
6impl Validator {
7 /// Validate a struct that implements our custom Validate trait, returning a Map of field errors
8 pub fn validate<T: Validate>(data: &T) -> Result<(), HashMap<String, String>> {
9 data.validate()
10 }
11}