Valitron is a validator on ergonomics

In the future, modularization will be supported

Inspired by axum

Features

Examples

``rust fn main() { let validator = Validator::new() .rule("name", Required.and(StartWith("hello"))) .rule("age", custom(age_limit)) .message([ ("name.required", "name is required"), ("name.start_with", "name should be starts withhello`"), ]);

let person = Person {
    name: "li",
    age: 18,
};

let res = validator.validate(person);

}

fn age_limit(n: &mut u8) -> Result<(), &'static str> { if *n >= 25 && *n <= 45 { return Ok(()); } Err("age should be between 25 and 45") } ```