Trait PartialSerializer

Source
pub trait PartialSerializer {
    // 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§

Source

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.

Implementors§