MCPcopy Index your code
hub / github.com/tinylib/msgp / DecodeMsg

Method DecodeMsg

msgp/setof/generated.go:1063–1088  ·  view source on GitHub ↗

DecodeMsg decodes the message from the reader.

(reader *msgp.Reader)

Source from the content-addressed store, hash-verified

1061
1062// DecodeMsg decodes the message from the reader.
1063func (s *ByteSorted) DecodeMsg(reader *msgp.Reader) error {
1064 if reader.IsNil() {
1065 *s = nil
1066 return reader.Skip()
1067 }
1068 sz, err := reader.ReadArrayHeader()
1069 if err != nil {
1070 return err
1071 }
1072 dst := *s
1073 if dst == nil {
1074 dst = make(ByteSorted, sz)
1075 } else {
1076 clear(dst)
1077 }
1078 for range sz {
1079 var k byte
1080 k, err = reader.ReadByte()
1081 if err != nil {
1082 return err
1083 }
1084 dst[byte(k)] = struct{}{}
1085 }
1086 *s = dst
1087 return nil
1088}
1089
1090// UnmarshalMsg decodes the message from the bytes.
1091func (s *ByteSorted) UnmarshalMsg(bytes []byte) ([]byte, error) {

Callers 4

TestByteSorted_RoundTripFunction · 0.95
TestByteSorted_EmptySetFunction · 0.95

Calls 4

IsNilMethod · 0.80
SkipMethod · 0.80
ReadArrayHeaderMethod · 0.80
ReadByteMethod · 0.80

Tested by 4

TestByteSorted_RoundTripFunction · 0.76
TestByteSorted_EmptySetFunction · 0.76