transition


Description:

public Future transition (uint target)

Requests a transition to target.

If target is a valid value for the state machine's enum type, it becomes the requested state immediately and can be read with [method@Dex.StateMachine.get_requested_state]. The requested state is the most recent valid target passed to this method. It may differ from the current state and does not imply that the transition will succeed.

Transition requests are serialized. The matching callback is run from a fiber and may use `dex_await()` to wait for asynchronous work. If the callback succeeds without calling [method@Dex.StateTransitionContext.set_state], the state machine commits target. If the callback updates the state directly, the returned future resolves to the current state after the callback returns.

Parameters:

this

a [class@Dex.StateMachine]

target

the target state

Returns:

a future resolving to the final enum state