packet::records

Trait RecordBuilder

Source
pub trait RecordBuilder {
    // Required methods
    fn serialized_len(&self) -> usize;
    fn serialize_into(&self, data: &mut [u8]);
}
Expand description

A builder capable of serializing a record.

Given R: RecordBuilder, an iterator of R can be used with a RecordSequenceBuilder to serialize a sequence of records.

Required Methods§

Source

fn serialized_len(&self) -> usize

Provides the serialized length of a record.

Returns the total length, in bytes, of the serialized encoding of self.

Source

fn serialize_into(&self, data: &mut [u8])

Serializes self into a buffer.

data will be exactly self.serialized_len() bytes long.

§Panics

May panic if data is not exactly self.serialized_len() bytes long.

Implementors§