Enum iron_valid::Rule [] [src]

pub enum Rule<'a> {
    Accepted,
    ActiveUrl,
    Alpha,
    AlphaDash,
    AlphaNumeric,
    Array,
    Between(isizeisize),
    Boolean,
    Confirmed,
    Different(&'static str),
    Digits(usize),
    DigitsBetween(usizeusize),
    Distinct,
    Email,
    Filled,
    In(Vec<Value>),
    InArray(&'static str),
    Integer,
    IpAddress,
    Json,
    Max(isize),
    Min(isize),
    NotIn(Vec<Value>),
    NotInArray(&'static str),
    Numeric,
    Present,
    Regex(&'static str),
    Required,
    RequiredIf(&'static strValue),
    RequiredUnless(&'static strValue),
    RequiredWith(Vec<&'static str>),
    RequiredWithAll(Vec<&'static str>),
    RequiredWithout(Vec<&'static str>),
    RequiredWithoutAll(Vec<&'static str>),
    Same(&'static str),
    Size(isize),
    String,
    Url,
    // some variants omitted
}

Variants

The field under validation must be yes, on, 1, or true. This is useful for validating "Terms of Service" acceptance.

On success, will transform the input to a boolean true.

The field under validation, if present, must be an active domain name.

The field under validation must be entirely alphabetic characters.

This validator accepts Latin and international (Unicode) input.

The field under validation may have alpha-numeric characters, as well as dashes and underscores.

This validator accepts Latin and international (Unicode) input.

The field under validation must be entirely alpha-numeric characters.

This validator accepts Latin and international (Unicode) input.

The field under validation, if present, must be an array.

The field under validation, if present, must have a size between the given min and max. Strings, numerics, and files are evaluated in the same fashion as the Size rule.

The field under validation, if present, must be able to be cast as a boolean. Accepted input are true, false, 1, 0, "1", and "0".

On success, will transform the input to a boolean true or false.

The field under validation must have a matching field of foo_confirmation. For example, if the field under validation is password, a matching password_confirmation field must be present in the input.

The field under validation must have a different value than field.

The field under validation, if present, must be numeric and must have an exact length of value.

For negative numbers, the negative sign is not counted as a digit. For floating point numbers, the number of digits preceeding the decimal place is counted.

On success, will transform string input to a numeric type.

The field under validation, if present, must have a length between the given min and max.

On success, will transform string input to a numeric type.

When working with arrays, the field under validation must not have any duplicate values if it is present.

The field under validation, if present, must be formatted as an e-mail address.

The field under validation must not be empty when it is present.

The field under validation, if present, must be included in the given list of values.

The field under validation, if present, must exist in anotherfield's values.

The field under validation, if present, must be an integer.

On success, will transform string input to a numeric type.

The field under validation, if present, must be an IP address.

Accepts both IPv4 and IPv6 addresses.

The field under validation, if present, must be a valid JSON string.

The field under validation, if present, must be less than or equal to a maximum value. Strings, numerics, and files are evaluated in the same fashion as the Size rule.

The field under validation, if present, must have a minimum value. Strings, numerics, and files are evaluated in the same fashion as the Size rule.

The field under validation must not be included in the given list of values.

The field under validation must not exist in anotherfield's values.

The field under validation, if present, must be numeric.

On success, will transform string input to a numeric type.

The field under validation must be present in the input data but can be empty.

The field under validation, if present, must match the given regular expression.

On success, will transform input to a string.

The field under validation must be present in the input data and not empty. A field is considered "empty" if one of the following conditions are true:

The value is null.

The value is an empty string.

The value is an empty array or empty object.

The field under validation must be present if the anotherfield field is equal to any value.

The field under validation must be present unless the anotherfield field is equal to any value.

The field under validation must be present only if any of the other specified fields are present.

The field under validation must be present only if all of the other specified fields are present.

The field under validation must be present only when any of the other specified fields are not present.

The field under validation must be present only when all of the other specified fields are not present.

The given field must match the field under validation.

The field under validation must have a size matching the given value.

For string data, value corresponds to the number of characters.

For numeric data, value corresponds to a given integer value.

For files, size corresponds to the file size in kilobytes.

The field under validation, if present, must be a string.

The field under validation, if present, must be formatted as a valid URL, but does not need to resolve to a real website. The URL must contain the scheme or else it will fail validation. For example, http://google.com will pass validation, but google.com will fail validation.

Trait Implementations

impl<'a> Clone for Rule<'a>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a> Debug for Rule<'a>
[src]

Formats the value using the given formatter.