Closed jedrzejboczar closed 3 years ago
Thanks for the PR! Could you add examples so it will test the feature better?
This has been on my TODO but never got around to it, thanks for looking at it! I'll give the feature a spin as well.
Oh, and can you have a look at the failing tests?
I added a basic usage example, hope it's ok
Thanks for the addition!
Thanks for this cool library!
In my state machine I have multiple state transitions that require running the same action, but in the current implementation of
smlang-rs
it results in multiple definitions of an action with the same name in theStateMachineContext
trait, so I have to use different name and write some boilerplate code.I added changes that will allow to use the same action name multiple times and generate only a single method for them. Do you think this is a good feature? My actions/states do not carry any additional data. I guess that with this changes, when someone tries to have to actions that would require different signatures, then the compilation will just fail.
One other thing is that it would be nice if it was possible to derive the
Debug
trait forEvents
/States
(always? or configurable?). It greatly improves debugging of the state machine behavior and currently I have to implement the trait manually. I also implementClone
forStates
manually (as my state has no data so could even byCopy
). I'm not sure how much effort would it be to be able to also derive it. Maybe some kind of a special syntax at the beginning of the macro?