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

Method DecodeMsg

msgp/setof/generated.go:622–647  ·  view source on GitHub ↗

DecodeMsg decodes the message from the reader.

(reader *msgp.Reader)

Source from the content-addressed store, hash-verified

620
621// DecodeMsg decodes the message from the reader.
622func (s *Uint) DecodeMsg(reader *msgp.Reader) error {
623 if reader.IsNil() {
624 *s = nil
625 return reader.Skip()
626 }
627 sz, err := reader.ReadArrayHeader()
628 if err != nil {
629 return err
630 }
631 dst := *s
632 if dst == nil {
633 dst = make(Uint, sz)
634 } else {
635 clear(dst)
636 }
637 for range sz {
638 var k uint
639 k, err = reader.ReadUint()
640 if err != nil {
641 return err
642 }
643 dst[uint(k)] = struct{}{}
644 }
645 *s = dst
646 return nil
647}
648
649// UnmarshalMsg decodes the message from the bytes.
650func (s *Uint) UnmarshalMsg(bytes []byte) ([]byte, error) {

Callers 4

TestUint_RoundTripFunction · 0.95
TestUint_NilHandlingFunction · 0.95
TestUint_EmptySetFunction · 0.95
BenchmarkUint_DecodeMsgFunction · 0.95

Calls 4

IsNilMethod · 0.80
SkipMethod · 0.80
ReadArrayHeaderMethod · 0.80
ReadUintMethod · 0.80

Tested by 4

TestUint_RoundTripFunction · 0.76
TestUint_NilHandlingFunction · 0.76
TestUint_EmptySetFunction · 0.76
BenchmarkUint_DecodeMsgFunction · 0.76