packet::records

Trait AlignedRecordBuilder

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

A builder capable of serializing a record with an alignment requirement.

Given R: AlignedRecordBuilder, an iterator of R can be used with an AlignedRecordSequenceBuilder to serialize a sequence of aligned records.

Required Methods§

Source

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

Returns the alignment requirement of self.

The alignment requirement is returned as (x, y), which means that the record must be aligned at x * n + y bytes from the beginning of the records sequence for some non-negative n.

It is guaranteed that x > 0 and that x > y.

Source

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

Serializes the padding between subsequent aligned records.

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

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.

Implementors§