MCPcopy Create free account
hub / github.com/buger/jsonparser / CodecEncodeSelf

Method CodecEncodeSelf

benchmark/benchmark_codecgen.go:2151–2234  ·  view source on GitHub ↗

Benchmark harness support for STK-REQ-004.

(e *codec1978.Encoder)

Source from the content-addressed store, hash-verified

2149
2150// Benchmark harness support for STK-REQ-004.
2151func (x *DSTopicsList) CodecEncodeSelf(e *codec1978.Encoder) {
2152 var h codecSelfer6617
2153 z, r := codec1978.GenHelperEncoder(e)
2154 _, _, _ = h, z, r
2155 if x == nil {
2156 r.EncodeNil()
2157 } else {
2158 if false {
2159 } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
2160 z.EncExtension(x, yyxt1)
2161 } else if !z.EncBinary() && z.IsJSONHandle() {
2162 z.EncJSONMarshal(x)
2163 } else {
2164 yysep2 := !z.EncBinary()
2165 yy2arr2 := z.EncBasicHandle().StructToArray
2166 _, _ = yysep2, yy2arr2
2167 const yyr2 bool = false // struct tag has 'toArray'
2168 if yyr2 || yy2arr2 {
2169 r.WriteArrayStart(2)
2170 } else {
2171 r.WriteMapStart(2)
2172 }
2173 if yyr2 || yy2arr2 {
2174 r.WriteArrayElem()
2175 if x.Topics == nil {
2176 r.EncodeNil()
2177 } else {
2178 if false {
2179 } else {
2180 h.encSlicePtrtoDSTopic(([]*DSTopic)(x.Topics), e)
2181 }
2182 }
2183 } else {
2184 r.WriteMapElemKey()
2185 if z.IsJSONHandle() {
2186 z.WriteStr("\"Topics\"")
2187 } else {
2188 r.EncodeStringEnc(codecSelferCcUTF86617, `Topics`)
2189 }
2190 r.WriteMapElemValue()
2191 if x.Topics == nil {
2192 r.EncodeNil()
2193 } else {
2194 if false {
2195 } else {
2196 h.encSlicePtrtoDSTopic(([]*DSTopic)(x.Topics), e)
2197 }
2198 }
2199 }
2200 if yyr2 || yy2arr2 {
2201 r.WriteArrayElem()
2202 if false {
2203 } else {
2204 if z.EncBasicHandle().StringToRaw {
2205 r.EncodeStringBytesRaw(z.BytesView(string(x.MoreTopicsUrl)))
2206 } else {
2207 r.EncodeStringEnc(codecSelferCcUTF86617, string(x.MoreTopicsUrl))
2208 }

Callers

nothing calls this directly

Calls 1

encSlicePtrtoDSTopicMethod · 0.95

Tested by

no test coverage detected