2019-02-20 18:39:32 +01:00
|
|
|
package io
|
|
|
|
|
2019-09-16 19:31:49 +03: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 18:39:32 +01:00
|
|
|
type Serializable interface {
|
2019-09-16 19:31:49 +03:00
|
|
|
DecodeBinary(*BinReader)
|
|
|
|
EncodeBinary(*BinWriter)
|
2019-02-20 18:39:32 +01:00
|
|
|
}
|
2019-12-06 18:13:52 +03:00
|
|
|
|
|
|
|
type decodable interface {
|
|
|
|
DecodeBinary(*BinReader)
|
|
|
|
}
|
2019-12-06 18:15:33 +03:00
|
|
|
|
|
|
|
type encodable interface {
|
|
|
|
EncodeBinary(*BinWriter)
|
|
|
|
}
|