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

Method DecodeMsg

msgp/setof/generated.go:2332–2357  ·  view source on GitHub ↗

DecodeMsg decodes the message from the reader.

(reader *msgp.Reader)

Source from the content-addressed store, hash-verified

2330
2331// DecodeMsg decodes the message from the reader.
2332func (s *Int32) DecodeMsg(reader *msgp.Reader) error {
2333 if reader.IsNil() {
2334 *s = nil
2335 return reader.Skip()
2336 }
2337 sz, err := reader.ReadArrayHeader()
2338 if err != nil {
2339 return err
2340 }
2341 dst := *s
2342 if dst == nil {
2343 dst = make(Int32, sz)
2344 } else {
2345 clear(dst)
2346 }
2347 for range sz {
2348 var k int32
2349 k, err = reader.ReadInt32()
2350 if err != nil {
2351 return err
2352 }
2353 dst[int32(k)] = struct{}{}
2354 }
2355 *s = dst
2356 return nil
2357}
2358
2359// UnmarshalMsg decodes the message from the bytes.
2360func (s *Int32) UnmarshalMsg(bytes []byte) ([]byte, error) {

Callers 4

TestInt32_RoundTripFunction · 0.95
TestInt32_NilHandlingFunction · 0.95
TestInt32_EmptySetFunction · 0.95
BenchmarkInt32_DecodeMsgFunction · 0.95

Calls 4

IsNilMethod · 0.80
SkipMethod · 0.80
ReadArrayHeaderMethod · 0.80
ReadInt32Method · 0.80

Tested by 4

TestInt32_RoundTripFunction · 0.76
TestInt32_NilHandlingFunction · 0.76
TestInt32_EmptySetFunction · 0.76
BenchmarkInt32_DecodeMsgFunction · 0.76