fsm/result.go
Frédéric G. MARAND 950b4ce20f
WIP
2023-04-04 10:45:10 +02:00

33 lines
600 B
Go

package fsm
// Result defines a possible outcome for a given FSM Transition.
type Result struct {
/**
* The return value of the event handler.
*
* @var mixed
*/
Return any
/**
* State is the state to which the FSM must change when handling this Result.
*
* If empty, do not change the current state.
*/
State
/**
* Action is the name of an event to be fired after the state change has been applied.
*
* @var string
*/
Action Event
}
func NewResult(ret any, state State, action Event) *Result {
return &Result{
Action: action,
Return: ret,
State: state,
}
}