Expand description
Built-in field validator constructors (required / length / email / range / regex / one-of).
Each function returns a closure suitable for
FormField::validate or
Validator::new. All matchers are
handwritten — there is no regex or email-parsing dependency.
Functions§
- Accept a plausibly-formed email address.
- max_len
- Require at most
ncharacters (counted as Unicode scalar values). - min_len
- Require at least
ncharacters (counted as Unicode scalar values). - one_of
- Require the input to be one of the allowed values (exact, case-sensitive).
- range_
f64 - Parse the input as an
f64and require it to fall withinlo..=hi. - range_
i64 - Parse the input as an
i64and require it to fall withinlo..=hi. - regex
- Match the input against a minimal glob-style pattern.
- required
- Reject empty or whitespace-only input.