-
Notifications
You must be signed in to change notification settings - Fork 5
/
hashfunc_enumer.go
51 lines (41 loc) · 1.17 KB
/
hashfunc_enumer.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
// Code generated by "enumer -type HashFunc"; DO NOT EDIT.
//
package xmssmt
import (
"fmt"
)
const _HashFuncName = "SHA2SHAKESHAKE256"
var _HashFuncIndex = [...]uint8{0, 4, 9, 17}
func (i HashFunc) String() string {
if i >= HashFunc(len(_HashFuncIndex)-1) {
return fmt.Sprintf("HashFunc(%d)", i)
}
return _HashFuncName[_HashFuncIndex[i]:_HashFuncIndex[i+1]]
}
var _HashFuncValues = []HashFunc{0, 1, 2}
var _HashFuncNameToValueMap = map[string]HashFunc{
_HashFuncName[0:4]: 0,
_HashFuncName[4:9]: 1,
_HashFuncName[9:17]: 2,
}
// HashFuncString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func HashFuncString(s string) (HashFunc, error) {
if val, ok := _HashFuncNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to HashFunc values", s)
}
// HashFuncValues returns all values of the enum
func HashFuncValues() []HashFunc {
return _HashFuncValues
}
// IsAHashFunc returns "true" if the value is listed in the enum definition. "false" otherwise
func (i HashFunc) IsAHashFunc() bool {
for _, v := range _HashFuncValues {
if i == v {
return true
}
}
return false
}