You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a single target state is defined in the machine::transitions!() macro for a specific transition, machine will generate a method that return the exact struct of the target, making this transition type safe: When implementing that transition, returning the wrong state will fail compilation.
But when multiple target states are defined in the machine::transitions!() macro, machine generates a method that returns the main enum. This means that those transitions user implementations can be wrong and not match what the macro contains.
I think the only type-safe way of doing this would be to generate a different enum for transitions to multiple targets. This would unfortunately create some monster enums like StateOneOrStateTwoOrStateFourteenOrStateFifty but I don't see how else it could be done...
The text was updated successfully, but these errors were encountered:
When a single target state is defined in the
machine::transitions!()
macro for a specific transition,machine
will generate a method that return the exact struct of the target, making this transition type safe: When implementing that transition, returning the wrong state will fail compilation.But when multiple target states are defined in the
machine::transitions!()
macro,machine
generates a method that returns the main enum. This means that those transitions user implementations can be wrong and not match what the macro contains.I think the only type-safe way of doing this would be to generate a different enum for transitions to multiple targets. This would unfortunately create some monster enums like
StateOneOrStateTwoOrStateFourteenOrStateFifty
but I don't see how else it could be done...The text was updated successfully, but these errors were encountered: