-
Notifications
You must be signed in to change notification settings - Fork 1
/
serial-do-type.go
41 lines (34 loc) · 993 Bytes
/
serial-do-type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
© 2022–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
ISC License
*/
package parl
import "strconv"
const (
// The SerialDo is invoking thunk from idle, now time
SerialDoLaunch SerialDoType = 1 + iota
// The SerialDo enqueued a future invocation, request time
SerialDoPending
// The SerialDo is launching a pending invocation, request time
SerialDoPendingLaunch
// The SerialDo returned to being idle, time is busy since
SerialDoIdle
)
var serialDoEventToString = map[SerialDoType]string{
SerialDoLaunch: "launch",
SerialDoPending: "enqueue",
SerialDoPendingLaunch: "launch-enqueued",
SerialDoIdle: "idle",
}
type SerialDoType uint8
func (e SerialDoType) IsValid() (isValid bool) {
_, isValid = serialDoEventToString[e]
return
}
func (e SerialDoType) String() (s string) {
var ok bool
if s, ok = serialDoEventToString[e]; !ok {
s = "unknown: " + strconv.FormatUint(uint64(e), 10)
}
return
}