github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/pkg/io/serializable.go (about) 1 package io 2 3 // Serializable defines the binary encoding/decoding interface. Errors are 4 // returned via BinReader/BinWriter Err field. These functions must have safe 5 // behavior when the passed BinReader/BinWriter with Err is already set. Invocations 6 // to these functions tend to be nested, with this mechanism only the top-level 7 // caller should handle an error once and all the other code should just not 8 // panic while there is an error. 9 type Serializable interface { 10 DecodeBinary(*BinReader) 11 EncodeBinary(*BinWriter) 12 } 13 14 type decodable interface { 15 DecodeBinary(*BinReader) 16 } 17 18 type encodable interface { 19 EncodeBinary(*BinWriter) 20 }