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

Method decodeJSONUnmarshaler

json/decode.go:1440–1456  ·  view source on GitHub ↗
(b []byte, p unsafe.Pointer, t reflect.Type, pointer bool)

Source from the content-addressed store, hash-verified

1438}
1439
1440func (d decoder) decodeJSONUnmarshaler(b []byte, p unsafe.Pointer, t reflect.Type, pointer bool) ([]byte, error) {
1441 v, b, _, err := d.parseValue(b)
1442 if err != nil {
1443 return b, err
1444 }
1445
1446 u := reflect.NewAt(t, p)
1447 if !pointer {
1448 u = u.Elem()
1449 t = t.Elem()
1450 }
1451 if u.IsNil() {
1452 u.Set(reflect.New(t))
1453 }
1454
1455 return b, u.Interface().(Unmarshaler).UnmarshalJSON(v)
1456}
1457
1458func (d decoder) decodeTextUnmarshaler(b []byte, p unsafe.Pointer, t reflect.Type, pointer bool) ([]byte, error) {
1459 var value string

Callers 1

Calls 3

parseValueMethod · 0.95
ElemMethod · 0.65
UnmarshalJSONMethod · 0.45

Tested by

no test coverage detected