Skip to main content

MaxLengthCheck

This class tracks and validates the length of a specific input field against an optional maximum limit. It maintains state for the current length, the maximum allowed length, and the actual length of the input to facilitate validation checks.

Attributes

AttributeTypeDescription
current_lengthusizeThe current count of elements or characters processed during the validation check.
max_lengthOption< usize >The maximum allowable length for the input, which triggers a validation failure if exceeded.
field_typestringA string label identifying the type of field being validated for use in error reporting.
inputINPUTA reference to the raw data or object being inspected for length constraints.
actual_lengthOption< usize >The final calculated length of the input used to compare against the maximum threshold.

Constructor

Signature

def MaxLengthCheck(
current_length: usize,
max_length: Option< usize >,
field_type: &str,
input: &INPUT,
actual_length: Option< usize >
) - > [MaxLengthCheck](maxlengthcheck.md?sid=input_return_enums_maxlengthcheck)

Parameters

NameTypeDescription
current_lengthusizeThe current length of the field being validated.
max_lengthOption< usize >The optional maximum length allowed for the field.
field_type&strA string slice representing the type of the field.
input&INPUTA reference to the input data being checked.
actual_lengthOption< usize >The optional actual length of the input data.