pub trait Deserialize {
const SERIALIZED_SIZE: usize;
// Required method
fn deserialize(src: &[u8]) -> Self;
}
Expand description
Trait for describing how a type can be parsed from a constant-size byte slice.
Required Associated Constants§
Sourceconst SERIALIZED_SIZE: usize
const SERIALIZED_SIZE: usize
The length of the buffer passed into Deserialize::deserialize
.
Required Methods§
Sourcefn deserialize(src: &[u8]) -> Self
fn deserialize(src: &[u8]) -> Self
Deserializes the byte buffer into the struct. The length of src
must
match the same type’s Deserialize::SERIALIZED_SIZE
constant.
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.