updateState

open override fun updateState(updater: (T) -> T): StateUpdateResult<T>

Updates the state using the provided updater function.

The updater function receives the current state and should return a new state. The new state will be validated before being accepted. If validation fails, the current state remains unchanged.

This operation is atomic and thread-safe.

Return

StateUpdateResult indicating success, validation failure, or update failure

Parameters

updater

Function that transforms the current state to a new state