github.com/avfs/avfs@v0.33.1-0.20240303173310-c6ba67c33eb7/features_string.go (about) 1 // Code generated by "stringer -type Features -trimprefix Feat -bitmask -output features_string.go"; DO NOT EDIT. 2 3 package avfs 4 5 import "strconv" 6 7 func _() { 8 // An "invalid array index" compiler error signifies that the constant values have changed. 9 // Re-run the stringer command to generate them again. 10 var x [1]struct{} 11 _ = x[FeatHardlink-1] 12 _ = x[FeatIdentityMgr-2] 13 _ = x[FeatSetOSType-4] 14 _ = x[FeatReadOnly-8] 15 _ = x[FeatReadOnlyIdm-16] 16 _ = x[FeatRealFS-32] 17 _ = x[FeatSubFS-64] 18 _ = x[FeatSymlink-128] 19 } 20 21 const _Features_name = "HardlinkIdentityMgrSetOSTypeReadOnlyReadOnlyIdmRealFSSubFSSymlink" 22 23 var _Features_map = map[Features]string{ 24 1: _Features_name[0:8], 25 2: _Features_name[8:19], 26 4: _Features_name[19:28], 27 8: _Features_name[28:36], 28 16: _Features_name[36:47], 29 32: _Features_name[47:53], 30 64: _Features_name[53:58], 31 128: _Features_name[58:65], 32 } 33 34 func (i Features) String() string { 35 if i <= 0 { 36 return "Features()" 37 } 38 sb := make([]byte, 0, len(_Features_name)/2) 39 sb = append(sb, []byte("Features(")...) 40 for mask := Features(1); mask > 0 && mask <= i; mask <<= 1 { 41 val := i & mask 42 if val == 0 { 43 continue 44 } 45 str, ok := _Features_map[val] 46 if !ok { 47 str = "0x" + strconv.FormatUint(uint64(val), 16) 48 } 49 sb = append(sb, []byte(str)...) 50 sb = append(sb, '|') 51 } 52 sb[len(sb)-1] = ')' 53 return string(sb) 54 }