2019-02-20 17:39:32 +00:00
|
|
|
package io
|
|
|
|
|
2019-09-16 16:31:49 +00:00
|
|
|
// Serializable defines the binary encoding/decoding interface. Errors are
|
|
|
|
// returned via BinReader/BinWriter Err field. These functions must have safe
|
2022-04-20 18:30:09 +00:00
|
|
|
// behavior when the passed BinReader/BinWriter with Err is already set. Invocations
|
2019-09-16 16:31:49 +00:00
|
|
|
// to these functions tend to be nested, with this mechanism only the top-level
|
2022-04-20 18:30:09 +00:00
|
|
|
// caller should handle an error once and all the other code should just not
|
|
|
|
// panic while there is an error.
|
2019-02-20 17:39:32 +00:00
|
|
|
type Serializable interface {
|
2019-09-16 16:31:49 +00:00
|
|
|
DecodeBinary(*BinReader)
|
|
|
|
EncodeBinary(*BinWriter)
|
2019-02-20 17:39:32 +00:00
|
|
|
}
|
2019-12-06 15:13:52 +00:00
|
|
|
|
|
|
|
type decodable interface {
|
|
|
|
DecodeBinary(*BinReader)
|
|
|
|
}
|
2019-12-06 15:15:33 +00:00
|
|
|
|
|
|
|
type encodable interface {
|
|
|
|
EncodeBinary(*BinWriter)
|
|
|
|
}
|