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

Method DecodeMsg

msgp/setof/generated.go:778–803  ·  view source on GitHub ↗

DecodeMsg decodes the message from the reader.

(reader *msgp.Reader)

Source from the content-addressed store, hash-verified

776
777// DecodeMsg decodes the message from the reader.
778func (s *UintSorted) DecodeMsg(reader *msgp.Reader) error {
779 if reader.IsNil() {
780 *s = nil
781 return reader.Skip()
782 }
783 sz, err := reader.ReadArrayHeader()
784 if err != nil {
785 return err
786 }
787 dst := *s
788 if dst == nil {
789 dst = make(UintSorted, sz)
790 } else {
791 clear(dst)
792 }
793 for range sz {
794 var k uint
795 k, err = reader.ReadUint()
796 if err != nil {
797 return err
798 }
799 dst[uint(k)] = struct{}{}
800 }
801 *s = dst
802 return nil
803}
804
805// UnmarshalMsg decodes the message from the bytes.
806func (s *UintSorted) UnmarshalMsg(bytes []byte) ([]byte, error) {

Callers 4

TestUintSorted_RoundTripFunction · 0.95
TestUintSorted_EmptySetFunction · 0.95

Calls 4

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

Tested by 4

TestUintSorted_RoundTripFunction · 0.76
TestUintSorted_EmptySetFunction · 0.76