Skip to main content

Module validator

Module validator 

Source

Structs§

EmailFormat
Basic email format validator. Auto-wired for Field::email().
MaxLength
Fails if the value’s character count is greater than n.
MaxValue
Fails if the value cannot be parsed as f64 or is greater than n.
MinLength
Fails if the value’s character count is less than n.
MinValue
Fails if the value cannot be parsed as f64 or is less than n.
RegexValidator
Fails if the value does not match pattern. The pattern is compiled once at construction.
Required
Fails if the value is an empty string. Auto-wired when .required() is called on a Field.
Unique
Fails if another row in the DB already has col = value. On edit, excludes the current record (matched by PK id).

Traits§

AsyncValidator
Asynchronous field validator. Used for validators that need DB access (e.g. Unique). record_id is the current record’s PK — pass Some on edit, None on create.
Validator
Synchronous field validator. Implement this for custom validation logic.