MCPcopy Create free account
hub / github.com/tinylib/msgp / DecodeMsg

Method DecodeMsg

msgp/setof/generated.go:1762–1787  ·  view source on GitHub ↗

DecodeMsg decodes the message from the reader.

(reader *msgp.Reader)

Source from the content-addressed store, hash-verified

1760
1761// DecodeMsg decodes the message from the reader.
1762func (s *Int16) DecodeMsg(reader *msgp.Reader) error {
1763 if reader.IsNil() {
1764 *s = nil
1765 return reader.Skip()
1766 }
1767 sz, err := reader.ReadArrayHeader()
1768 if err != nil {
1769 return err
1770 }
1771 dst := *s
1772 if dst == nil {
1773 dst = make(Int16, sz)
1774 } else {
1775 clear(dst)
1776 }
1777 for range sz {
1778 var k int16
1779 k, err = reader.ReadInt16()
1780 if err != nil {
1781 return err
1782 }
1783 dst[int16(k)] = struct{}{}
1784 }
1785 *s = dst
1786 return nil
1787}
1788
1789// UnmarshalMsg decodes the message from the bytes.
1790func (s *Int16) UnmarshalMsg(bytes []byte) ([]byte, error) {

Callers 4

TestInt16_RoundTripFunction · 0.95
TestInt16_NilHandlingFunction · 0.95
TestInt16_EmptySetFunction · 0.95
BenchmarkInt16_DecodeMsgFunction · 0.95

Calls 4

IsNilMethod · 0.80
SkipMethod · 0.80
ReadArrayHeaderMethod · 0.80
ReadInt16Method · 0.80

Tested by 4

TestInt16_RoundTripFunction · 0.76
TestInt16_NilHandlingFunction · 0.76
TestInt16_EmptySetFunction · 0.76
BenchmarkInt16_DecodeMsgFunction · 0.76