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