EncodeMsg encodes the message to the writer.
(writer *msgp.Writer)
| 15 | |
| 16 | // EncodeMsg encodes the message to the writer. |
| 17 | func (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. |
| 35 | func (s String) MarshalMsg(bytes []byte) ([]byte, error) { |