MCPcopy Index your code
hub / github.com/segmentio/encoding / encodeSlice

Method encodeSlice

json/encode.go:298–306  ·  view source on GitHub ↗
(b []byte, p unsafe.Pointer, size uintptr, t reflect.Type, encode encodeFunc)

Source from the content-addressed store, hash-verified

296}
297
298func (e encoder) encodeSlice(b []byte, p unsafe.Pointer, size uintptr, t reflect.Type, encode encodeFunc) ([]byte, error) {
299 s := (*slice)(p)
300
301 if s.data == nil && s.len == 0 && s.cap == 0 {
302 return append(b, "null"...), nil
303 }
304
305 return e.encodeArray(b, s.data, s.len, size, t, encode)
306}
307
308func (e encoder) encodeMap(b []byte, p unsafe.Pointer, t reflect.Type, encodeKey, encodeValue encodeFunc, sortKeys sortFunc) ([]byte, error) {
309 m := reflect.NewAt(t, p).Elem()

Callers 2

constructSliceEncodeFuncFunction · 0.80

Calls 1

encodeArrayMethod · 0.95

Tested by

no test coverage detected