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

Method DecodeMsg

msgp/setof/generated.go:3757–3782  ·  view source on GitHub ↗

DecodeMsg decodes the message from the reader.

(reader *msgp.Reader)

Source from the content-addressed store, hash-verified

3755
3756// DecodeMsg decodes the message from the reader.
3757func (s *Float32) DecodeMsg(reader *msgp.Reader) error {
3758 if reader.IsNil() {
3759 *s = nil
3760 return reader.Skip()
3761 }
3762 sz, err := reader.ReadArrayHeader()
3763 if err != nil {
3764 return err
3765 }
3766 dst := *s
3767 if dst == nil {
3768 dst = make(Float32, sz)
3769 } else {
3770 clear(dst)
3771 }
3772 for range sz {
3773 var k float32
3774 k, err = reader.ReadFloat32()
3775 if err != nil {
3776 return err
3777 }
3778 dst[float32(k)] = struct{}{}
3779 }
3780 *s = dst
3781 return nil
3782}
3783
3784// UnmarshalMsg decodes the message from the bytes.
3785func (s *Float32) UnmarshalMsg(bytes []byte) ([]byte, error) {

Callers 4

TestFloat32_RoundTripFunction · 0.95
TestFloat32_NilHandlingFunction · 0.95
TestFloat32_EmptySetFunction · 0.95

Calls 4

IsNilMethod · 0.80
SkipMethod · 0.80
ReadArrayHeaderMethod · 0.80
ReadFloat32Method · 0.80

Tested by 4

TestFloat32_RoundTripFunction · 0.76
TestFloat32_NilHandlingFunction · 0.76
TestFloat32_EmptySetFunction · 0.76