Module constraint

Source
Expand description

Constraints defined by this crate

For each constraint the possible error codes are defined as a set of constants. The name of the constants follow the naming convention:

INVALID_<constraint-name>[_<variant>]

The part is optional and only present if the constraint has some variants. The name of a constraint and its variants is converted to screaming snake case. The string values of the error codes follow a similar naming convention but use a dash (-) instead of the underscore to separate terms. Thus the codes are compatible with the convention used in the fluent project.

Structs§

AssertFalse
The value must be false.
AssertTrue
The value must be true.
Contains
The value must contain the specified member or the specified member must be part of the value.
Digits
Maximum number of allowed integer digits and fraction digits.
MustMatch
Two related fields must be equal.
NonZero
Values of zero are not allowed.
NotEmpty
The value must not be empty.
Pattern
The value must match some regular expression.

Enums§

Bound
The value must be within some bounds.
CharCount
The number of characters must be within some bounds.
Length
The length of a value must be within some bounds.
MustDefineRange
Two related fields must define a range.

Constants§

INVALID_ASSERT_FALSE
Error code: the value does not assert to false (AssertFalse constraint)
INVALID_ASSERT_TRUE
Error code: the value does not assert to true (AssertTrue constraint)
INVALID_BOUND_CLOSED_MAX
Error code: the value is not less than or equal to the specified maximum (Bound::ClosedRange or Bound::OpenClosedRange constraint)
INVALID_BOUND_CLOSED_MIN
Error code: the value is not greater than or equal to the specified minimum (Bound::ClosedRange or Bound::ClosedOpenRange constraint)
INVALID_BOUND_EXACT
Error code: the value is not exactly the specified value (Bound::Exact constraint)
INVALID_BOUND_OPEN_MAX
Error code: the value is not less than the specified maximum (Bound::OpenRange or Bound::ClosedOpenRange constraint)
INVALID_BOUND_OPEN_MIN
Error code: the value is not greater than the specified minimum (Bound::OpenRange or Bound::OpenClosedRange constraint)
INVALID_CHAR_COUNT_EXACT
Error code: the number of characters is not exactly the specified value (CharCount::Exact constraint)
INVALID_CHAR_COUNT_MAX
Error code: the number of characters is not less or equal the specified maximum (CharCount::Max constraint)
INVALID_CHAR_COUNT_MIN
Error code: the number of characters is not greater or equal the specified minimum (CharCount::Min constraint)
INVALID_CONTAINS_ELEMENT
Error code: the value does not contain the specified member element (Contains constraint)
INVALID_DIGITS_FRACTION
Error code: the number of fraction digits is not less than or equal to the specified maximum (Digits::fraction constraint)
INVALID_DIGITS_INTEGER
Error code: the number of integer digits is not less than or equal to the specified maximum (Digits::integer constraint)
INVALID_LENGTH_EXACT
Error code: the length is not the exactly the specified value (Length::Exact constraint)
INVALID_LENGTH_MAX
Error code: the length is not less or equal the specified maximum (Length::Max constraint)
INVALID_LENGTH_MIN
Error code: the length is not greater or equal the specified minimum (Length::Min constraint)
INVALID_MUST_DEFINE_RANGE_EXCLUSIVE
Error code: the first value is not less than the second value (MustDefineRange::Exclusive constraint)
INVALID_MUST_DEFINE_RANGE_INCLUSIVE
Error code: the first value is not less than or equal to the second value (MustDefineRange::Inclusive constraint)
INVALID_MUST_MATCH
Error code: the two values do not match (MustMatch constraint)
INVALID_NON_ZERO
Error code: the value is zero (NonZero constraint)
INVALID_NOT_EMPTY
Error code: the value is empty (NotEmpty constraint)
INVALID_PATTERN
Error code: the value does not match the specified pattern (Pattern constraint)