-
Notifications
You must be signed in to change notification settings - Fork 13
/
crash_enum.go
68 lines (56 loc) · 1.59 KB
/
crash_enum.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 go-enum
// DO NOT EDIT!
package procio
import (
"fmt"
"strings"
)
const (
// CrashMethodCreateThreadOnNull is a CrashMethod of type CreateThreadOnNull
CrashMethodCreateThreadOnNull CrashMethod = iota
)
const _CrashMethodName = "CreateThreadOnNull"
var _CrashMethodNames = []string{
_CrashMethodName[0:18],
}
// CrashMethodNames returns a list of possible string values of CrashMethod.
func CrashMethodNames() []string {
tmp := make([]string, len(_CrashMethodNames))
copy(tmp, _CrashMethodNames)
return tmp
}
var _CrashMethodMap = map[CrashMethod]string{
0: _CrashMethodName[0:18],
}
// String implements the Stringer interface.
func (x CrashMethod) String() string {
if str, ok := _CrashMethodMap[x]; ok {
return str
}
return fmt.Sprintf("CrashMethod(%d)", x)
}
var _CrashMethodValue = map[string]CrashMethod{
_CrashMethodName[0:18]: 0,
strings.ToLower(_CrashMethodName[0:18]): 0,
}
// ParseCrashMethod attempts to convert a string to a CrashMethod
func ParseCrashMethod(name string) (CrashMethod, error) {
if x, ok := _CrashMethodValue[name]; ok {
return x, nil
}
return CrashMethod(0), fmt.Errorf("%s is not a valid CrashMethod, try [%s]", name, strings.Join(_CrashMethodNames, ", "))
}
// MarshalText implements the text marshaller method
func (x CrashMethod) MarshalText() ([]byte, error) {
return []byte(x.String()), nil
}
// UnmarshalText implements the text unmarshaller method
func (x *CrashMethod) UnmarshalText(text []byte) error {
name := string(text)
tmp, err := ParseCrashMethod(name)
if err != nil {
return err
}
*x = tmp
return nil
}