pub trait PacketBuilder {
type Output;
// Required method
fn build(self) -> Self::Output;
}Expand description
Common interface for all packet builders.
This is the Template Method pattern: every builder follows the same
high-level construction sequence (validate → assemble header → seal
checksum → append payload), but customizes the concrete steps via its
own field values and the checksum helpers (seal_internet_checksum
and seal_transport_checksum).
§Template sequence
- Validate — reject field values that violate protocol constraints
- Assemble header — write fixed and variable fields into the buffer
- Seal checksum — zero the checksum field, compute, write back
- Append payload — attach the user-supplied payload bytes
- Return — hand back the complete
Vec<u8>packet
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".