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

Method EncodeMsg

msgp/setof/generated.go:17–32  ·  view source on GitHub ↗

EncodeMsg encodes the message to the writer.

(writer *msgp.Writer)

Source from the content-addressed store, hash-verified

15
16// EncodeMsg encodes the message to the writer.
17func (s String) EncodeMsg(writer *msgp.Writer) error {
18 if s == nil {
19 return writer.WriteNil()
20 }
21 err := writer.WriteArrayHeader(uint32(len(s)))
22 if err != nil {
23 return err
24 }
25 for k := range s {
26 err = writer.WriteString(k)
27 if err != nil {
28 return err
29 }
30 }
31 return nil
32}
33
34// MarshalMsg encodes the message to the bytes.
35func (s String) MarshalMsg(bytes []byte) ([]byte, error) {

Callers 1

TestString_NilHandlingFunction · 0.95

Calls 3

WriteNilMethod · 0.80
WriteArrayHeaderMethod · 0.80
WriteStringMethod · 0.65

Tested by 1

TestString_NilHandlingFunction · 0.76