[][src]Function valid::invalid_value

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

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.