pub trait Serialize: Sized {
// Required methods
fn to_bytes(&self) -> Result<Vec<u8>>;
fn from_bytes(bytes: &[u8]) -> Result<Self>;
}
Expand description
Trait for objects that can be serialized to and from bytes
Required Methods§
Sourcefn from_bytes(bytes: &[u8]) -> Result<Self>
fn from_bytes(bytes: &[u8]) -> Result<Self>
Create an object from a byte array
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.