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

Method DecodeMsg

msgp/setof/generated.go:493–518  ·  view source on GitHub ↗

DecodeMsg decodes the message from the reader.

(reader *msgp.Reader)

Source from the content-addressed store, hash-verified

491
492// DecodeMsg decodes the message from the reader.
493func (s *IntSorted) DecodeMsg(reader *msgp.Reader) error {
494 if reader.IsNil() {
495 *s = nil
496 return reader.Skip()
497 }
498 sz, err := reader.ReadArrayHeader()
499 if err != nil {
500 return err
501 }
502 dst := *s
503 if dst == nil {
504 dst = make(IntSorted, sz)
505 } else {
506 clear(dst)
507 }
508 for range sz {
509 var k int
510 k, err = reader.ReadInt()
511 if err != nil {
512 return err
513 }
514 dst[int(k)] = struct{}{}
515 }
516 *s = dst
517 return nil
518}
519
520// UnmarshalMsg decodes the message from the bytes.
521func (s *IntSorted) UnmarshalMsg(bytes []byte) ([]byte, error) {

Callers 4

TestIntSorted_RoundTripFunction · 0.95
TestIntSorted_EmptySetFunction · 0.95

Calls 4

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

Tested by 4

TestIntSorted_RoundTripFunction · 0.76
TestIntSorted_EmptySetFunction · 0.76