Skip to main content

ScopedSetState

No overview available.

Attributes

AttributeTypeDescription
state[SerializationState](serializationstate.md?sid=serializers_extra_serializationstate)The state which has been set for the scope.
projectorcallableA function that projects from the state to the field that has been set.
valueTThe previous value of the field that has been set.

Constructor

Signature

@staticmethod
def new(
state: &'scope mut SerializationState< 'py >,
projector: P,
new_value: T
) - > [ScopedSetState](../../validators/validation/state/scopedsetstate.md?sid=validators_validation_state_scopedsetstate)

Parameters

NameTypeDescription
state&'scope mut SerializationState< 'py >The mutable reference to the serialization state being modified.
projectorPA closure or function used to access and modify a specific field within the serialization state.
new_valueTThe temporary value to be applied to the projected field for the duration of the scope.