korken89 / smlang-rs

A State Machine Language DSL procedual macro for Rust
Apache License 2.0
202 stars 28 forks source link

Visualization shows only one action associated with each event #18

Open bitob opened 3 years ago

bitob commented 3 years ago

When using features = ["graphviz"] to visualize a statemachine, every event will only be displayed with one of its associated actions.

Giving this small statemachine example:

statemachine! {
    transitions: {
        *Idle + ButtonPressed / start_doing_fancy_stuff = DoingFancyStuff,
        DoingFancyStuff + ButtonPressed / stop_doing_fancy_stuff = Idle,
    }
}

The generated visualization looks like that: statemachine

The association between ButtonPressed and stop_doing_fancy_stuff is not present in the graphic.

I guess the event/action pairs are plotted separately to prevent the graph from getting to cluttered. But since events aren't necessarily associated with only one action, this approach will hide some information about the statemachine.

Since the only unique association for events and action is the transition, the actions and guards have to be printed directly in the graph or a complete list of transitions needs to be added instead of the event/action boxes.

korken89 commented 3 years ago

Hmm, I think this might have broken during all the updates that was made.