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§


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.


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.