-
Notifications
You must be signed in to change notification settings - Fork 25
/
enumgen.go
48 lines (32 loc) · 1.73 KB
/
enumgen.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
// Code generated by "core generate"; DO NOT EDIT.
package econfig
import (
"cogentcore.org/core/enums"
)
var _TestEnumValues = []TestEnum{0, 1}
// TestEnumN is the highest valid value for type TestEnum, plus one.
const TestEnumN TestEnum = 2
var _TestEnumValueMap = map[string]TestEnum{`TestValue1`: 0, `TestValue2`: 1}
var _TestEnumDescMap = map[TestEnum]string{0: ``, 1: ``}
var _TestEnumMap = map[TestEnum]string{0: `TestValue1`, 1: `TestValue2`}
// String returns the string representation of this TestEnum value.
func (i TestEnum) String() string { return enums.String(i, _TestEnumMap) }
// SetString sets the TestEnum value from its string representation,
// and returns an error if the string is invalid.
func (i *TestEnum) SetString(s string) error {
return enums.SetString(i, s, _TestEnumValueMap, "TestEnum")
}
// Int64 returns the TestEnum value as an int64.
func (i TestEnum) Int64() int64 { return int64(i) }
// SetInt64 sets the TestEnum value from an int64.
func (i *TestEnum) SetInt64(in int64) { *i = TestEnum(in) }
// Desc returns the description of the TestEnum value.
func (i TestEnum) Desc() string { return enums.Desc(i, _TestEnumDescMap) }
// TestEnumValues returns all possible values for the type TestEnum.
func TestEnumValues() []TestEnum { return _TestEnumValues }
// Values returns all possible values for the type TestEnum.
func (i TestEnum) Values() []enums.Enum { return enums.Values(_TestEnumValues) }
// MarshalText implements the [encoding.TextMarshaler] interface.
func (i TestEnum) MarshalText() ([]byte, error) { return []byte(i.String()), nil }
// UnmarshalText implements the [encoding.TextUnmarshaler] interface.
func (i *TestEnum) UnmarshalText(text []byte) error { return enums.UnmarshalText(i, text, "TestEnum") }