// Code generated by "enumer -type=Rank"; DO NOT EDIT. // package main import ( "fmt" ) const _RankName = "FlagSpyScoutMinerCaptainGeneralMarshal" var _RankIndex = [...]uint8{0, 4, 7, 12, 17, 24, 31, 38} func (i Rank) String() string { if i < 0 || i >= Rank(len(_RankIndex)-1) { return fmt.Sprintf("Rank(%d)", i) } return _RankName[_RankIndex[i]:_RankIndex[i+1]] } var _RankValues = []Rank{0, 1, 2, 3, 4, 5, 6} var _RankNameToValueMap = map[string]Rank{ _RankName[0:4]: 0, _RankName[4:7]: 1, _RankName[7:12]: 2, _RankName[12:17]: 3, _RankName[17:24]: 4, _RankName[24:31]: 5, _RankName[31:38]: 6, } // RankString retrieves an enum value from the enum constants string name. // Throws an error if the param is not part of the enum. func RankString(s string) (Rank, error) { if val, ok := _RankNameToValueMap[s]; ok { return val, nil } return 0, fmt.Errorf("%s does not belong to Rank values", s) } // RankValues returns all values of the enum func RankValues() []Rank { return _RankValues } // IsARank returns "true" if the value is listed in the enum definition. "false" otherwise func (i Rank) IsARank() bool { for _, v := range _RankValues { if i == v { return true } } return false }