MCPcopy Index your code
hub / github.com/ugorji/go / sideEncode

Method sideEncode

codec/encode.go:1472–1496  ·  view source on GitHub ↗
(v interface{}, basetype reflect.Type, bs *[]byte)

Source from the content-addressed store, hash-verified

1470}
1471
1472func (e *Encoder) sideEncode(v interface{}, basetype reflect.Type, bs *[]byte) {
1473 // rv := baseRV(v)
1474 // e2 := NewEncoderBytes(bs, e.hh)
1475 // e2.encodeValue(rv, e2.h.fnNoExt(basetype))
1476 // e2.atEndOfEncode()
1477 // e2.w().end()
1478
1479 defer func(wb bytesEncAppender, bytes bool, c containerState, state interface{}) {
1480 e.wb = wb
1481 e.bytes = bytes
1482 e.c = c
1483 e.e.restoreState(state)
1484 }(e.wb, e.bytes, e.c, e.e.captureState())
1485
1486 e.wb = bytesEncAppender{encInBytes(bs)[:0], bs}
1487 e.bytes = true
1488 e.c = 0
1489 e.e.resetState()
1490
1491 // must call using fnNoExt
1492 rv := baseRV(v)
1493 e.encodeValue(rv, e.h.fnNoExt(basetype))
1494 e.atEndOfEncode()
1495 e.w().end()
1496}
1497
1498func encInBytes(out *[]byte) (in []byte) {
1499 in = *out

Callers 3

EncodeExtMethod · 0.80
EncodeExtMethod · 0.80
EncodeExtMethod · 0.80

Calls 10

encodeValueMethod · 0.95
atEndOfEncodeMethod · 0.95
wMethod · 0.95
encInBytesFunction · 0.85
baseRVFunction · 0.85
fnNoExtMethod · 0.80
restoreStateMethod · 0.65
captureStateMethod · 0.65
resetStateMethod · 0.65
endMethod · 0.65

Tested by

no test coverage detected