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

Method DecodeMsg

msgp/setof/generated.go:1192–1217  ·  view source on GitHub ↗

DecodeMsg decodes the message from the reader.

(reader *msgp.Reader)

Source from the content-addressed store, hash-verified

1190
1191// DecodeMsg decodes the message from the reader.
1192func (s *Int8) DecodeMsg(reader *msgp.Reader) error {
1193 if reader.IsNil() {
1194 *s = nil
1195 return reader.Skip()
1196 }
1197 sz, err := reader.ReadArrayHeader()
1198 if err != nil {
1199 return err
1200 }
1201 dst := *s
1202 if dst == nil {
1203 dst = make(Int8, sz)
1204 } else {
1205 clear(dst)
1206 }
1207 for range sz {
1208 var k int8
1209 k, err = reader.ReadInt8()
1210 if err != nil {
1211 return err
1212 }
1213 dst[int8(k)] = struct{}{}
1214 }
1215 *s = dst
1216 return nil
1217}
1218
1219// UnmarshalMsg decodes the message from the bytes.
1220func (s *Int8) UnmarshalMsg(bytes []byte) ([]byte, error) {

Callers 4

TestInt8_RoundTripFunction · 0.95
TestInt8_NilHandlingFunction · 0.95
TestInt8_EmptySetFunction · 0.95
BenchmarkInt8_DecodeMsgFunction · 0.95

Calls 4

IsNilMethod · 0.80
SkipMethod · 0.80
ReadArrayHeaderMethod · 0.80
ReadInt8Method · 0.80

Tested by 4

TestInt8_RoundTripFunction · 0.76
TestInt8_NilHandlingFunction · 0.76
TestInt8_EmptySetFunction · 0.76
BenchmarkInt8_DecodeMsgFunction · 0.76