pub enum ValidateError {
    InputTooShort {
        field: &'static str,
        min: i64,
    },
    InputTooLong {
        field: &'static str,
        max: i64,
    },
    TooSmall {
        field: &'static str,
        min: i64,
    },
    TooLarge {
        field: &'static str,
        max: i64,
    },
    InvalidCharacters {
        field: &'static str,
    },
    InvalidEmail {
        field: &'static str,
    },
    InvalidPhoneNumber {
        field: &'static str,
    },
    InvalidRegex {
        field: &'static str,
    },
    FieldMismatch {
        field: &'static str,
    },
}
Expand description

Errors that can appear if validation fails

Variants

InputTooShort

Fields

field: &'static str
min: i64

Input was too short (< min_length)

InputTooLong

Fields

field: &'static str
max: i64

Input was too long (> max_length)

TooSmall

Fields

field: &'static str
min: i64

Minimum value for an integer field

TooLarge

Fields

field: &'static str
max: i64

Maximum value for an integer field

InvalidCharacters

Fields

field: &'static str

Input contained invalid characters (invalid)

InvalidEmail

Fields

field: &'static str

The email entered does not match our email regex

InvalidPhoneNumber

Fields

field: &'static str

The phone number entered does not match our regex

InvalidRegex

Fields

field: &'static str

The field failed the user-passed regex

FieldMismatch

Fields

field: &'static str

Two fields do not match

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.