github.com/goki/ki@v1.1.11/kit/testflags_string.go (about)

     1  // Code generated by "stringer -type=TestFlags"; DO NOT EDIT.
     2  
     3  package kit
     4  
     5  import (
     6  	"fmt"
     7  	"strconv"
     8  )
     9  
    10  const _TestFlags_name = "TestFlagsNilTestFlag1TestFlag2TestFlagsN"
    11  
    12  var _TestFlags_index = [...]uint8{0, 12, 21, 30, 40}
    13  
    14  func (i TestFlags) String() string {
    15  	if i < 0 || i >= TestFlags(len(_TestFlags_index)-1) {
    16  		return "TestFlags(" + strconv.FormatInt(int64(i), 10) + ")"
    17  	}
    18  	return _TestFlags_name[_TestFlags_index[i]:_TestFlags_index[i+1]]
    19  }
    20  
    21  func (i *TestFlags) FromString(s string) error {
    22  	for j := 0; j < len(_TestFlags_index)-1; j++ {
    23  		if s == _TestFlags_name[_TestFlags_index[j]:_TestFlags_index[j+1]] {
    24  			*i = TestFlags(j)
    25  			return nil
    26  		}
    27  	}
    28  	return fmt.Errorf("String %v is not a valid option for type TestFlags", s)
    29  }