Bytes encodes the FZSet instance into bytes using MessagePack binary serialization format. The encoded bytes can be used for storage or transmission. If the encoding operation fails, an error is returned.
()
| 1047 | // storage or transmission. If the encoding operation fails, an |
| 1048 | // error is returned. |
| 1049 | func (fzs *FZSet) Bytes() ([]byte, error) { |
| 1050 | var msgPack = encoding.NewMessagePackEncoder() |
| 1051 | if encodingError := msgPack.Encode(fzs); encodingError != nil { |
| 1052 | return nil, encodingError |
| 1053 | } |
| 1054 | return msgPack.Bytes(), nil |
| 1055 | } |
| 1056 | |
| 1057 | // FromBytes decodes the input byte slice into the FZSet object using MessagePack. |
| 1058 | // Returns an error if decoding fails, otherwise nil. |