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

Method EncMapStringStringV

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

Source from the content-addressed store, hash-verified

1025 fastpathTV.EncMapStringStringV(rv2i(rv).(map[string]string), e)
1026}
1027func (fastpathT) EncMapStringStringV(v map[string]string, e *Encoder) {
1028 e.mapStart(len(v))
1029 if e.h.Canonical {
1030 v2 := make([]string, len(v))
1031 var i uint
1032 for k := range v {
1033 v2[i] = k
1034 i++
1035 }
1036 sort.Sort(stringSlice(v2))
1037 for _, k2 := range v2 {
1038 e.mapElemKey()
1039 e.e.EncodeString(k2)
1040 e.mapElemValue()
1041 e.e.EncodeString(v[k2])
1042 }
1043 } else {
1044 for k2, v2 := range v {
1045 e.mapElemKey()
1046 e.e.EncodeString(k2)
1047 e.mapElemValue()
1048 e.e.EncodeString(v2)
1049 }
1050 }
1051 e.mapEnd()
1052}
1053func (e *Encoder) fastpathEncMapStringBytesR(f *codecFnInfo, rv reflect.Value) {
1054 fastpathTV.EncMapStringBytesV(rv2i(rv).(map[string][]byte), e)
1055}

Callers 7

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

Calls 6

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

Tested by 5

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