Function invalid_value

Source
pub fn invalid_value(
    code: impl Into<Cow<'static, str>>,
    field_name: impl Into<FieldName>,
    actual_value: impl Into<Value>,
    expected_value: impl Into<Value>,
) -> ConstraintViolation
Expand description

Convenience function to construct a ConstraintViolation for a validation performed in the FieldName context.

Use this method if the field value is mandatory. If the field is of type Option<T> consider using the invalid_optional_value method instead.