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
| Attribute | Type | Description |
|---|---|---|
| current_length | usize | The current count of elements or characters processed during the validation check. |
| max_length | Option< usize > | The maximum allowable length for the input, which triggers a validation failure if exceeded. |
| field_type | string | A string label identifying the type of field being validated for use in error reporting. |
| input | INPUT | A reference to the raw data or object being inspected for length constraints. |
| actual_length | Option< 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
| Name | Type | Description |
|---|---|---|
| current_length | usize | The current length of the field being validated. |
| max_length | Option< usize > | The optional maximum length allowed for the field. |
| field_type | &str | A string slice representing the type of the field. |
| input | &INPUT | A reference to the input data being checked. |
| actual_length | Option< usize > | The optional actual length of the input data. |