pub trait PartialSerializer: Sized {
// Required method
fn partial_serialize(
&self,
outer: PacketConstraints,
buffer: &mut [u8],
) -> Result<PartialSerializeResult, SerializeError<Never>>;
}
Expand description
A serializer that supports partial serialization.
Partial serialization allows to serialize only packet headers without calculating packet checksums (if any).
Required Methods§
Sourcefn partial_serialize(
&self,
outer: PacketConstraints,
buffer: &mut [u8],
) -> Result<PartialSerializeResult, SerializeError<Never>>
fn partial_serialize( &self, outer: PacketConstraints, buffer: &mut [u8], ) -> Result<PartialSerializeResult, SerializeError<Never>>
Serializes the head of the packet to the specified buffer
.
If the packet contains network or transport level headers that fit in the provided buffer then they will be serialized. Complete or partial body may be copied to the output buffer as well, depending on the serializer type.
PartialSerializeResult.bytes_written
indicates how many bytes were
actually serialized.
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.