MarshalMsg encodes the message to the bytes.
(bytes []byte)
| 307 | |
| 308 | // MarshalMsg encodes the message to the bytes. |
| 309 | func (s Int) MarshalMsg(bytes []byte) ([]byte, error) { |
| 310 | if s == nil { |
| 311 | return msgp.AppendNil(bytes), nil |
| 312 | } |
| 313 | if len(s) == 0 { |
| 314 | return msgp.AppendArrayHeader(bytes, 0), nil |
| 315 | } |
| 316 | bytes = ensure(bytes, s.Msgsize()) |
| 317 | bytes = msgp.AppendArrayHeader(bytes, uint32(len(s))) |
| 318 | for k := range s { |
| 319 | bytes = msgp.AppendInt(bytes, int(k)) |
| 320 | } |
| 321 | return bytes, nil |
| 322 | } |
| 323 | |
| 324 | // AsSlice returns the set as a slice. |
| 325 | func (s Int) AsSlice() []int { |