add_messages!() { /* proc-macro */ }
Expand description

Generates code to push messages into states or poll messages from states.

The messaging definition is expected too hold to the following pattern:

add_messages!(
    StateMachineName,
    [
        Message1 <- State1,
        Message2 <- State1,
        Message1 -> State2,
        ...
    ]
);
  • StateMachineName: This must match a previously with add_state_machine defined state machine.
  • [ Message1 <- State1, … ] Defines all messages that can be passed back an forth. The message specifies the struct/enum that will be used as a message, the <- arrow defines a poll and the -> a push and the state is the target or source state. For each message, the source/target state must implement the according ReceiveMessage or ReturnMessage trait. An example might look like this.
add_messages!(
        Rocket,
        [
            Command<Launch> -> Action<Descent>,
            Command<Land> -> Action<Ascent>,
            Status <- Action<Ascent>,
            Status <- Action<Descent>
        ]
);