state

Attribute Macro state 

Source
#[state]
Available on crate feature macro only.
Expand description

Attribute for tagging a state.

This macro does nothing on its own but is detected by the state_machine macro when added to a method.

It accepts the following attributes:

  • #[state(name = "CustomStateName")]

    Set the name of the variant that will be part of the state enum.


  • #[state(superstate = "superstate_name")]

    Set the superstate of the state.


  • #[state(entry_action = "entry_action_name")]

    Set the entry action of the state.


  • #[state(exit_action = "exit_action_name")]

    Set the exit action of the state.


  • #[state(local_storage("field_name_a: FieldTypeA", "field_name_b: FieldTypeB"))]

    Add local storage to this state. These will be added as fields to the enum variant.