-
Notifications
You must be signed in to change notification settings - Fork 2
/
enum_canbeusedwhen.go
68 lines (56 loc) · 1.73 KB
/
enum_canbeusedwhen.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Code generated by "enumerator -type CanBeUsedWhen -linecomment -trimprefix"; DO NOT EDIT.
package actor
import (
"fmt"
"strconv"
)
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[CanBeUsedWhenUnknown-0]
_ = x[CanBeUsedWhenCapacityLost-1]
_ = x[CanBeUsedWhenHasCapacity-2]
}
const _CanBeUsedWhen_name = "Unknownwhen-capacity-lostwhen-has-capacity"
var _CanBeUsedWhen_index = [...]uint8{0, 7, 25, 42}
func (i CanBeUsedWhen) String() string {
if i >= CanBeUsedWhen(len(_CanBeUsedWhen_index)-1) {
return "CanBeUsedWhen(" + strconv.FormatInt(int64(i), 10) + ")"
}
return _CanBeUsedWhen_name[_CanBeUsedWhen_index[i]:_CanBeUsedWhen_index[i+1]]
}
func (i CanBeUsedWhen) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}
func (i CanBeUsedWhen) IsUnknown() bool {
return i == CanBeUsedWhenUnknown
}
func (i CanBeUsedWhen) IsCapacityLost() bool {
return i == CanBeUsedWhenCapacityLost
}
func (i CanBeUsedWhen) IsHasCapacity() bool {
return i == CanBeUsedWhenHasCapacity
}
func ParseCanBeUsedWhen(s string) (CanBeUsedWhen, error) {
switch s {
case "Unknown":
return CanBeUsedWhenUnknown, nil
case "when-capacity-lost":
return CanBeUsedWhenCapacityLost, nil
case "when-has-capacity":
return CanBeUsedWhenHasCapacity, nil
default:
return CanBeUsedWhen(0), fmt.Errorf("invalid CanBeUsedWhen '%s'", s)
}
}
type CanBeUsedWhenOptions struct {
Unknown CanBeUsedWhen
CapacityLost CanBeUsedWhen
HasCapacity CanBeUsedWhen
}
var CanBeUsedWhenValues = CanBeUsedWhenOptions{
Unknown: CanBeUsedWhenUnknown,
CapacityLost: CanBeUsedWhenCapacityLost,
HasCapacity: CanBeUsedWhenHasCapacity,
}