MCPcopy
hub / github.com/segmentio/kafka-go / writerEncodeFuncOf

Function writerEncodeFuncOf

protocol/encode.go:513–527  ·  view source on GitHub ↗
(typ reflect.Type)

Source from the content-addressed store, hash-verified

511}
512
513func writerEncodeFuncOf(typ reflect.Type) encodeFunc {
514 typ = reflect.PtrTo(typ)
515 return func(e *encoder, v value) {
516 // Optimization to write directly into the buffer when the encoder
517 // does no need to compute a crc32 checksum.
518 w := io.Writer(e)
519 if e.table == nil {
520 w = e.writer
521 }
522 _, err := v.iface(typ).(io.WriterTo).WriteTo(w)
523 if err != nil {
524 e.err = err
525 }
526 }
527}
528
529func writeInt8(b []byte, i int8) {
530 b[0] = byte(i)

Callers 1

encodeFuncOfFunction · 0.85

Calls 2

WriteToMethod · 0.45
ifaceMethod · 0.45

Tested by

no test coverage detected