Serialize this codec to a self-describing byte buffer.
(&self)
| 120 | |
| 121 | /// Serialize this codec to a self-describing byte buffer. |
| 122 | pub fn to_bytes(&self) -> Result<Vec<u8>, CodecError> { |
| 123 | codec_envelope::encode(Self::ENVELOPE_MAGIC, Self::ENVELOPE_VERSION, self) |
| 124 | } |
| 125 | |
| 126 | /// Deserialize a codec from a byte buffer produced by [`Self::to_bytes`]. |
| 127 | pub fn from_bytes(buf: &[u8]) -> Result<Self, CodecError> { |