github.com/goki/ki@v1.1.17/kit/testflags_string.go (about) 1 // Code generated by "stringer -type=TestFlags"; DO NOT EDIT. 2 3 package kit 4 5 import ( 6 "errors" 7 "strconv" 8 ) 9 10 func _() { 11 // An "invalid array index" compiler error signifies that the constant values have changed. 12 // Re-run the stringer command to generate them again. 13 var x [1]struct{} 14 _ = x[TestFlagsNil-0] 15 _ = x[TestFlag1-1] 16 _ = x[TestFlag2-2] 17 _ = x[TestFlagsN-3] 18 } 19 20 const _TestFlags_name = "TestFlagsNilTestFlag1TestFlag2TestFlagsN" 21 22 var _TestFlags_index = [...]uint8{0, 12, 21, 30, 40} 23 24 func (i TestFlags) String() string { 25 if i < 0 || i >= TestFlags(len(_TestFlags_index)-1) { 26 return "TestFlags(" + strconv.FormatInt(int64(i), 10) + ")" 27 } 28 return _TestFlags_name[_TestFlags_index[i]:_TestFlags_index[i+1]] 29 } 30 31 func (i *TestFlags) FromString(s string) error { 32 for j := 0; j < len(_TestFlags_index)-1; j++ { 33 if s == _TestFlags_name[_TestFlags_index[j]:_TestFlags_index[j+1]] { 34 *i = TestFlags(j) 35 return nil 36 } 37 } 38 return errors.New("String: " + s + " is not a valid option for type: TestFlags") 39 } 40 41 var _TestFlags_descMap = map[TestFlags]string{ 42 0: ``, 43 1: ``, 44 2: ``, 45 3: ``, 46 } 47 48 func (i TestFlags) Desc() string { 49 if str, ok := _TestFlags_descMap[i]; ok { 50 return str 51 } 52 return "TestFlags(" + strconv.FormatInt(int64(i), 10) + ")" 53 }