ValidateToSet
No overview available.
Attributes
| Attribute | Type | Description |
|---|---|---|
| py | Python | The Python interpreter instance used for managing object references and memory within the validation context. |
| input | [Input](../../input/input/abstract/input.md?sid=input_input_abstract_input) | The raw input data being validated and converted into a set. |
| set | Bound< PySet > | The target Python set object where validated items are collected. |
| max_length | usize | The maximum number of elements allowed in the resulting set; validation fails if this limit is exceeded. |
| item_validator | [CombinedValidator](../mod/combinedvalidator.md?sid=validators_mod_combinedvalidator) | The validator instance applied to each individual element within the input collection. |
| state | [ValidationState](../validation/state/validationstate.md?sid=validators_validation_state_validationstate) | The current validation state used to track errors, recursion depth, and configuration across the validation process. |
| fail_fast | bool | A flag that determines whether validation should stop immediately upon encountering the first error. |
Constructor
Signature
def ValidateToSet(
py: Python< 'py >,
input: &'a I,
set: &'a Bound< 'py, PySet >,
max_length: Option< usize >,
item_validator: &'a CombinedValidator,
state: &'a mut ValidationState< 's, 'py >,
fail_fast: bool
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| py | Python< 'py > | The Python interpreter instance. |
| input | &'a I | The input data to be validated. |
| set | &'a Bound< 'py, PySet > | The Python set object to be populated. |
| max_length | Option< usize > | Optional maximum length constraint for the set. |
| item_validator | &'a CombinedValidator | The validator used for individual items within the set. |
| state | &'a mut ValidationState< 's, 'py > | The current validation state and context. |
| fail_fast | bool | Whether to stop validation after the first error is encountered. |
Methods
validate()
def validate(
input: [Input](../../input/input/abstract/input.md?sid=input_input_abstract_input),
max_length: Option< usize >,
item_validator: [CombinedValidator](../mod/combinedvalidator.md?sid=validators_mod_combinedvalidator),
state: [ValidationState](../validation/state/validationstate.md?sid=validators_validation_state_validationstate),
fail_fast: bool
) - > Bound< 'py, PySet >
Validates input data against set constraints and populates a Python set with validated items.
Parameters
| Name | Type | Description |
|---|---|---|
| input | [Input](../../input/input/abstract/input.md?sid=input_input_abstract_input) | The raw input data to be validated and converted into a set. |
| max_length | Option< usize > | The maximum number of items allowed in the set to prevent memory exhaustion. |
| item_validator | [CombinedValidator](../mod/combinedvalidator.md?sid=validators_mod_combinedvalidator) | The validator instance used to process and verify each individual element within the input. |
| state | [ValidationState](../validation/state/validationstate.md?sid=validators_validation_state_validationstate) | The current validation context used to track errors and recursion depth. |
| fail_fast | bool | If true, validation stops immediately upon encountering the first error instead of collecting all errors. |
Returns
| Type | Description |
|---|---|
Bound< 'py, PySet > | A Python set containing the successfully validated and converted items. |