machine/message.go
Matthew Rich a4942d95a1
Some checks failed
Machine Tests / test (push) Waiting to run
Lint / golangci-lint (push) Has been cancelled
fix module path
2024-04-04 11:52:39 -07:00

31 lines
488 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)
}