Dex.StateMachine.transition

### Method

# Dex StateMachinetransition

#### Declaration [src]

    DexFuture*
    dex_state_machine_transition (
      DexStateMachine* state_machine,
      guint target
    )

#### Description [src]

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 `dex_state_machine_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 `dex_state_transition_context_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

`target`

  Type: `guint`

  The target state.

#### Return value

Type: `DexFuture`

A future resolving to the final enum state.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.