pub trait Serializable {
// Required methods
fn serialize(&self) -> CoreResult<Vec<u8>>;
fn deserialize(bytes: &[u8]) -> CoreResult<Self>
where Self: Sized;
fn type_name(&self) -> &str;
}Expand description
Trait for serializable objects.
Required Methods§
Sourcefn serialize(&self) -> CoreResult<Vec<u8>>
fn serialize(&self) -> CoreResult<Vec<u8>>
Serialize the object to a byte vector.
Sourcefn deserialize(bytes: &[u8]) -> CoreResult<Self>where
Self: Sized,
fn deserialize(bytes: &[u8]) -> CoreResult<Self>where
Self: Sized,
Deserialize the object from a byte vector.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".