dcrypt_api/traits/
serialize.rs

1//! Trait definition for serialization
2
3use crate::Result;
4
5/// Trait for objects that can be serialized to and from bytes
6pub trait Serialize: Sized {
7    /// Convert the object to a byte array
8    fn to_bytes(&self) -> Result<Vec<u8>>;
9
10    /// Create an object from a byte array
11    fn from_bytes(bytes: &[u8]) -> Result<Self>;
12}