pub trait ReadOnlySerializer<ReceivingPacket, SendingPacket>:
Send
+ Sync
+ 'static {
type Error: Error + Send + Sync;
// Required methods
fn serialize(&self, packet: SendingPacket) -> Result<Vec<u8>, Self::Error>;
fn deserialize(&self, buffer: &[u8]) -> Result<ReceivingPacket, Self::Error>;
}
Expand description
ReadOnlySerializer is designed for scenarios where the data structure does not change, ensuring efficient and thread-safe operations without the overhead of locking mechanisms.