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

Method EncodeMsg

msgp/setof/generated.go:861–876  ·  view source on GitHub ↗

EncodeMsg encodes the message to the writer.

(writer *msgp.Writer)

Source from the content-addressed store, hash-verified

859
860// EncodeMsg encodes the message to the writer.
861func (s Byte) EncodeMsg(writer *msgp.Writer) error {
862 if s == nil {
863 return writer.WriteNil()
864 }
865 err := writer.WriteArrayHeader(uint32(len(s)))
866 if err != nil {
867 return err
868 }
869 for k := range s {
870 err = writer.WriteByte(k)
871 if err != nil {
872 return err
873 }
874 }
875 return nil
876}
877
878// MarshalMsg encodes the message to the bytes.
879func (s Byte) MarshalMsg(bytes []byte) ([]byte, error) {

Callers 1

TestByte_NilHandlingFunction · 0.95

Calls 3

WriteNilMethod · 0.80
WriteArrayHeaderMethod · 0.80
WriteByteMethod · 0.80

Tested by 1

TestByte_NilHandlingFunction · 0.76