MCPcopy Index your code
hub / github.com/vmihailenco/msgpack / encodeByteArrayValue

Function encodeByteArrayValue

encode_slice.go:20–33  ·  view source on GitHub ↗
(e *Encoder, v reflect.Value)

Source from the content-addressed store, hash-verified

18}
19
20func encodeByteArrayValue(e *Encoder, v reflect.Value) error {
21 if err := e.EncodeBytesLen(v.Len()); err != nil {
22 return err
23 }
24
25 if v.CanAddr() {
26 b := v.Slice(0, v.Len()).Bytes()
27 return e.write(b)
28 }
29
30 e.buf = grow(e.buf, v.Len())
31 reflect.Copy(reflect.ValueOf(e.buf), v)
32 return e.write(e.buf)
33}
34
35func grow(b []byte, n int) []byte {
36 if cap(b) >= n {

Callers

nothing calls this directly

Calls 3

growFunction · 0.85
EncodeBytesLenMethod · 0.80
writeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…