pub async fn validate(
request: &mut Request,
rules: &[(&str, &str)],
) -> Result<Validated, Errors>Expand description
Validate a request against Laravel-style rule strings.
The shortest path from a request to trusted data: on success the validated
subset comes back, on failure an Errors that already knows whether the
client wanted JSON.
§Panics
If a rule spec is malformed. A bad spec is a bug in the source rather than
bad input from a user, and the panic carries the parser’s message — which
names the rule and suggests the one that was meant. Use Rules::parse
when the spec comes from data instead of from code.