MarshalMsg encodes the message to the bytes.
(bytes []byte)
| 877 | |
| 878 | // MarshalMsg encodes the message to the bytes. |
| 879 | func (s Byte) MarshalMsg(bytes []byte) ([]byte, error) { |
| 880 | if s == nil { |
| 881 | return msgp.AppendNil(bytes), nil |
| 882 | } |
| 883 | if len(s) == 0 { |
| 884 | return msgp.AppendArrayHeader(bytes, 0), nil |
| 885 | } |
| 886 | bytes = ensure(bytes, s.Msgsize()) |
| 887 | bytes = msgp.AppendArrayHeader(bytes, uint32(len(s))) |
| 888 | for k := range s { |
| 889 | bytes = msgp.AppendByte(bytes, byte(k)) |
| 890 | } |
| 891 | return bytes, nil |
| 892 | } |
| 893 | |
| 894 | // AsSlice returns the set as a slice. |
| 895 | func (s Byte) AsSlice() []byte { |