Skip to main content

ValidateToSet

No overview available.

Attributes

AttributeTypeDescription
pyPythonThe 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.
setBound< PySet >The target Python set object where validated items are collected.
max_lengthusizeThe 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_fastboolA 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

NameTypeDescription
pyPython< 'py >The Python interpreter instance.
input&'a IThe input data to be validated.
set&'a Bound< 'py, PySet >The Python set object to be populated.
max_lengthOption< usize >Optional maximum length constraint for the set.
item_validator&'a CombinedValidatorThe validator used for individual items within the set.
state&'a mut ValidationState< 's, 'py >The current validation state and context.
fail_fastboolWhether 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

NameTypeDescription
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_lengthOption< 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_fastboolIf true, validation stops immediately upon encountering the first error instead of collecting all errors.

Returns

TypeDescription
Bound< 'py, PySet >A Python set containing the successfully validated and converted items.