pub trait AlignedOptionBuilder: OptionBuilder {
    // Required methods
    fn alignment_requirement(&self) -> (usize, usize);
    fn serialize_padding(buf: &mut [u8], length: usize);
}
Expand description

A builder capable of serializing an option with an alignment requirement.

Given O: AlignedOptionBuilder, an iterator of O can be used with an AlignedOptionSequenceBuilder to serialize a sequence of aligned options.

Required Methods§

source

fn alignment_requirement(&self) -> (usize, usize)

Returns the alignment requirement of self.

option.alignment_requirement() returns (x, y), which means that the serialized encoding of option must be aligned at x * n + y bytes from the beginning of the options sequence for some non-negative n. For example, the IPv6 Router Alert Hop-by-Hop option has alignment (2, 0), while the Jumbo Payload option has alignment (4, 2). (1, 0) means there is no alignment requirement.

x must be non-zero and y must be smaller than x.

source

fn serialize_padding(buf: &mut [u8], length: usize)

Serializes the padding between subsequent aligned options.

Some formats require that padding bytes have particular content. This function serializes padding bytes as required by the format.

Object Safety§

This trait is not object safe.

Implementors§