machine/message.go
Matthew Rich 2b3068fcd0
Some checks failed
Machine Tests / test (push) Waiting to run
Lint / golangci-lint (push) Has been cancelled
fix message member scope
2024-05-06 22:41:29 -07:00

31 lines
485 B
Go

// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package machine
import (
"fmt"
)
const (
ENTERSTATEEVENT = iota
EXITSTATEEVENT
)
type Eventtype int
type EventMessage struct {
On Eventtype
Source State
Dest State
}
type EventChannel chan EventMessage
func (e *EventChannel) Notify(m *EventMessage) {
*e <- *m
}
func (m EventMessage) String() string {
return fmt.Sprintf("{On: %d, Source: %s, Dest: %s}", m.On, m.Source, m.Dest)
}