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

Method DecodeMsg

msgp/setof/generated.go:907–932  ·  view source on GitHub ↗

DecodeMsg decodes the message from the reader.

(reader *msgp.Reader)

Source from the content-addressed store, hash-verified

905
906// DecodeMsg decodes the message from the reader.
907func (s *Byte) DecodeMsg(reader *msgp.Reader) error {
908 if reader.IsNil() {
909 *s = nil
910 return reader.Skip()
911 }
912 sz, err := reader.ReadArrayHeader()
913 if err != nil {
914 return err
915 }
916 dst := *s
917 if dst == nil {
918 dst = make(Byte, sz)
919 } else {
920 clear(dst)
921 }
922 for range sz {
923 var k byte
924 k, err = reader.ReadByte()
925 if err != nil {
926 return err
927 }
928 dst[byte(k)] = struct{}{}
929 }
930 *s = dst
931 return nil
932}
933
934// UnmarshalMsg decodes the message from the bytes.
935func (s *Byte) UnmarshalMsg(bytes []byte) ([]byte, error) {

Callers 4

TestByte_RoundTripFunction · 0.95
TestByte_NilHandlingFunction · 0.95
TestByte_EmptySetFunction · 0.95
BenchmarkByte_DecodeMsgFunction · 0.95

Calls 4

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

Tested by 4

TestByte_RoundTripFunction · 0.76
TestByte_NilHandlingFunction · 0.76
TestByte_EmptySetFunction · 0.76
BenchmarkByte_DecodeMsgFunction · 0.76