blob: 60e1721f24c0f98deceacad6888306549aae799b [file] [log] [blame]
use bytes::Bytes;
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 to_bytes(&self) -> Bytes;
/// Deserializes the struct from bytes.
fn from_bytes(bytes: Bytes) -> Result<Self, IggyError>
where
Self: Sized;
}