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

     1  // Code generated by "stringer -type=Flags"; DO NOT EDIT.
     2  
     3  package ki
     4  
     5  import (
     6  	"errors"
     7  	"strconv"
     8  )
     9  
    10  var _ = errors.New("dummy error")
    11  
    12  func _() {
    13  	// An "invalid array index" compiler error signifies that the constant values have changed.
    14  	// Re-run the stringer command to generate them again.
    15  	var x [1]struct{}
    16  	_ = x[IsField-0]
    17  	_ = x[HasKiFields-1]
    18  	_ = x[HasNoKiFields-2]
    19  	_ = x[Updating-3]
    20  	_ = x[OnlySelfUpdate-4]
    21  	_ = x[NodeDeleted-5]
    22  	_ = x[NodeDestroyed-6]
    23  	_ = x[ChildAdded-7]
    24  	_ = x[ChildDeleted-8]
    25  	_ = x[ChildrenDeleted-9]
    26  	_ = x[ValUpdated-10]
    27  	_ = x[FlagsN-11]
    28  }
    29  
    30  const _Flags_name = "IsFieldHasKiFieldsHasNoKiFieldsUpdatingOnlySelfUpdateNodeDeletedNodeDestroyedChildAddedChildDeletedChildrenDeletedValUpdatedFlagsN"
    31  
    32  var _Flags_index = [...]uint8{0, 7, 18, 31, 39, 53, 64, 77, 87, 99, 114, 124, 130}
    33  
    34  func (i Flags) String() string {
    35  	if i < 0 || i >= Flags(len(_Flags_index)-1) {
    36  		return "Flags(" + strconv.FormatInt(int64(i), 10) + ")"
    37  	}
    38  	return _Flags_name[_Flags_index[i]:_Flags_index[i+1]]
    39  }
    40  
    41  func (i *Flags) FromString(s string) error {
    42  	for j := 0; j < len(_Flags_index)-1; j++ {
    43  		if s == _Flags_name[_Flags_index[j]:_Flags_index[j+1]] {
    44  			*i = Flags(j)
    45  			return nil
    46  		}
    47  	}
    48  	return errors.New("String: " + s + " is not a valid option for type: Flags")
    49  }