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
|
|
|
|
// behavior when passed BinReader/BinWriter with Err already set. Invocations
|
|
|
|
// to these functions tend to be nested, with this mechanism only the top-level
|
|
|
|
// caller should handle the error once and all the other code should just not
|
|
|
|
// panic in presence of 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)
|
|
|
|
}
|