pub trait Serialize: Sized {
// Required methods
fn from_bytes(bytes: &[u8]) -> Result<Self>;
fn to_bytes(&self) -> Vec<u8> ⓘ;
}
Expand description
A trait for public types that can be serialized to and from bytes.
Required Methods§
Sourcefn from_bytes(bytes: &[u8]) -> Result<Self>
fn from_bytes(bytes: &[u8]) -> Result<Self>
Creates an object from a byte slice.
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.