MCPcopy
hub / github.com/ugorji/go / EncMapStringBytesV

Method EncMapStringBytesV

codec/fast-path.generated.go:1056–1081  ·  view source on GitHub ↗
(v map[string][]byte, e *Encoder)

Source from the content-addressed store, hash-verified

1054 fastpathTV.EncMapStringBytesV(rv2i(rv).(map[string][]byte), e)
1055}
1056func (fastpathT) EncMapStringBytesV(v map[string][]byte, e *Encoder) {
1057 e.mapStart(len(v))
1058 if e.h.Canonical {
1059 v2 := make([]string, len(v))
1060 var i uint
1061 for k := range v {
1062 v2[i] = k
1063 i++
1064 }
1065 sort.Sort(stringSlice(v2))
1066 for _, k2 := range v2 {
1067 e.mapElemKey()
1068 e.e.EncodeString(k2)
1069 e.mapElemValue()
1070 e.e.EncodeStringBytesRaw(v[k2])
1071 }
1072 } else {
1073 for k2, v2 := range v {
1074 e.mapElemKey()
1075 e.e.EncodeString(k2)
1076 e.mapElemValue()
1077 e.e.EncodeStringBytesRaw(v2)
1078 }
1079 }
1080 e.mapEnd()
1081}
1082func (e *Encoder) fastpathEncMapStringUint8R(f *codecFnInfo, rv reflect.Value) {
1083 fastpathTV.EncMapStringUint8V(rv2i(rv).(map[string]uint8), e)
1084}

Callers 6

CodecEncodeSelfMethod · 0.80
fastpathEncodeTypeSwitchFunction · 0.80
CodecEncodeSelfMethod · 0.80
CodecEncodeSelfMethod · 0.80
CodecEncodeSelfMethod · 0.80

Calls 7

stringSliceTypeAlias · 0.85
EncodeStringMethod · 0.65
EncodeStringBytesRawMethod · 0.65
mapStartMethod · 0.45
mapElemKeyMethod · 0.45
mapElemValueMethod · 0.45
mapEndMethod · 0.45

Tested by 4

CodecEncodeSelfMethod · 0.64
CodecEncodeSelfMethod · 0.64
CodecEncodeSelfMethod · 0.64
CodecEncodeSelfMethod · 0.64