Macro apis::def_program [] [src]

macro_rules! def_program {
    ( program $program:ident where let $result:ident = session.run() {
      MODES [
        $(
        mode $mode_mod:ident :: $mode_context:ident $($transition_choice:block)*
        )+
      ]
      TRANSITIONS [
        $(transition $transition:ident
          <$source_mod:ident :: $source_context:ident> =>
          <$target_mod:ident :: $target_context:ident> $([
            $($source_proc:ident ($prev_proc:ident) =>
              $target_proc:ident ($next_proc:ident) $closure_block:block)*
          ])*
        )+
      ]
      initial_mode: $initial_mode:ident
    }

  ) => { ... };
    (@option_transition_choice /* no choice */) => { ... };
    (@option_transition_choice $transition_choice:block) => { ... };
}

Define a Program state machine.

The transition system defined by a Program is implemented as a state machine.

The two parts to the Program definition are the mode definitions and transition definitions.