#[derive(Validate)]
{
// Attributes available to this derive:
#[validate]
}
Expand description
Derives the modo::validate::Validate trait for a named-field struct.
Annotate fields with #[validate(...)] to declare one or more rules.
Available rules:
required— field must not beNone(forOption) or empty (forString)min_length = N/max_length = N— minimum/maximum character count for stringsemail— basic email format checkmin = V/max = V— numeric range for comparable typescustom = "path::to::fn"— call afn(&T) -> Result<(), String>function
Each rule accepts an optional (message = "...") override. A field-level
message = "..." key acts as a fallback for all rules on that field.
validate() returns Ok(()) or Err(modo::Error) containing all
collected error messages keyed by field name.