MCPcopy
hub / github.com/tinylib/msgp / DecodeMsg

Method DecodeMsg

msgp/setof/generated.go:337–362  ·  view source on GitHub ↗

DecodeMsg decodes the message from the reader.

(reader *msgp.Reader)

Source from the content-addressed store, hash-verified

335
336// DecodeMsg decodes the message from the reader.
337func (s *Int) DecodeMsg(reader *msgp.Reader) error {
338 if reader.IsNil() {
339 *s = nil
340 return reader.Skip()
341 }
342 sz, err := reader.ReadArrayHeader()
343 if err != nil {
344 return err
345 }
346 dst := *s
347 if dst == nil {
348 dst = make(Int, sz)
349 } else {
350 clear(dst)
351 }
352 for range sz {
353 var k int
354 k, err = reader.ReadInt()
355 if err != nil {
356 return err
357 }
358 dst[int(k)] = struct{}{}
359 }
360 *s = dst
361 return nil
362}
363
364// UnmarshalMsg decodes the message from the bytes.
365func (s *Int) UnmarshalMsg(bytes []byte) ([]byte, error) {

Callers 4

TestInt_RoundTripFunction · 0.95
TestInt_NilHandlingFunction · 0.95
TestInt_EmptySetFunction · 0.95
BenchmarkInt_DecodeMsgFunction · 0.95

Calls 4

IsNilMethod · 0.80
SkipMethod · 0.80
ReadArrayHeaderMethod · 0.80
ReadIntMethod · 0.80

Tested by 4

TestInt_RoundTripFunction · 0.76
TestInt_NilHandlingFunction · 0.76
TestInt_EmptySetFunction · 0.76
BenchmarkInt_DecodeMsgFunction · 0.76