Bytes serializes the State using protobuf. It panics if either casting to protobuf or serialization fails.
()
| 114 | // Bytes serializes the State using protobuf. |
| 115 | // It panics if either casting to protobuf or serialization fails. |
| 116 | func (state State) Bytes() []byte { |
| 117 | sm, err := state.ToProto() |
| 118 | if err != nil { |
| 119 | panic(err) |
| 120 | } |
| 121 | bz, err := proto.Marshal(sm) |
| 122 | if err != nil { |
| 123 | panic(err) |
| 124 | } |
| 125 | return bz |
| 126 | } |
| 127 | |
| 128 | // IsEmpty returns true if the State is equal to the empty State. |
| 129 | func (state State) IsEmpty() bool { |