blob: 00b3ab37454e6489aeb60c703c7f598ec4dc4f3f [file]
use crate::error::IggyError;
/// The trait represents the logic responsible for serializing and deserializing the struct to and from bytes.
pub trait BytesSerializable {
/// Serializes the struct to bytes.
fn as_bytes(&self) -> Vec<u8>;
/// Deserializes the struct from bytes.
fn from_bytes(bytes: &[u8]) -> Result<Self, IggyError>
where
Self: Sized;
}