pub trait PacketPayloadEncoder {
    fn encoding_size_hint<E: Encoder>(
        &mut self,
        encoder: &E,
        minimum_len: usize
    ) -> usize; fn encode(
        &mut self,
        buffer: &mut EncoderBuffer<'_>,
        minimum_len: usize,
        header_len: usize,
        tag_len: usize
    ); }

Required Methods

Returns an estimate of the encoding size of the payload. This may be inaccurate from what actually is encoded. Estimates should be less than or equal to what is actually written. Implementations can return 0 to skip encoding.

Encodes the payload into the buffer. Implementations should ensure the encoding len is at least the minimum_len, otherwise the packet writing will panic.

Implementors