UnmarshalMsg decodes the message from the bytes.
(bytes []byte)
| 1374 | |
| 1375 | // UnmarshalMsg decodes the message from the bytes. |
| 1376 | func (s *Int8Sorted) UnmarshalMsg(bytes []byte) ([]byte, error) { |
| 1377 | if msgp.IsNil(bytes) { |
| 1378 | *s = nil |
| 1379 | return bytes[msgp.NilSize:], nil |
| 1380 | } |
| 1381 | // Read the array header |
| 1382 | sz, bytes, err := msgp.ReadArrayHeaderBytes(bytes) |
| 1383 | if err != nil { |
| 1384 | return nil, err |
| 1385 | } |
| 1386 | dst := *s |
| 1387 | if dst == nil { |
| 1388 | dst = make(Int8Sorted, sz) |
| 1389 | } else { |
| 1390 | clear(dst) |
| 1391 | } |
| 1392 | for range sz { |
| 1393 | var k int8 |
| 1394 | k, bytes, err = msgp.ReadInt8Bytes(bytes) |
| 1395 | if err != nil { |
| 1396 | return nil, err |
| 1397 | } |
| 1398 | dst[int8(k)] = struct{}{} |
| 1399 | } |
| 1400 | *s = dst |
| 1401 | return bytes, nil |
| 1402 | } |
| 1403 | |
| 1404 | // Msgsize returns the maximum size of the message. |
| 1405 | func (s Int8Sorted) Msgsize() int { |