MCPcopy Create free account
hub / github.com/segmentio/encoding / messageDecodeFuncOf

Function messageDecodeFuncOf

proto/message.go:347–362  ·  view source on GitHub ↗
(t reflect.Type)

Source from the content-addressed store, hash-verified

345}
346
347func messageDecodeFuncOf(t reflect.Type) decodeFunc {
348 return func(b []byte, p unsafe.Pointer, flags flags) (int, error) {
349 m := reflect.NewAt(t, p).Interface().(Message)
350
351 if flags.has(toplevel) {
352 return len(b), m.Unmarshal(b)
353 }
354
355 v, n, err := decodeVarlen(b)
356 if err != nil {
357 return n, err
358 }
359
360 return n + len(v), m.Unmarshal(v)
361 }
362}

Callers 1

messageCodecOfFunction · 0.85

Calls 3

decodeVarlenFunction · 0.85
UnmarshalMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…