pub trait FromBytes: Sized {
// Required method
fn from_bytes(bytes: &[u8]) -> Result<&Self, BytesSizeError>;
}
Required Methods§
Sourcefn from_bytes(bytes: &[u8]) -> Result<&Self, BytesSizeError>
fn from_bytes(bytes: &[u8]) -> Result<&Self, BytesSizeError>
Create a new instance from bytes Returns Err if the bytes length doesn’t match the struct size
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.