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

Required Methods§

source

fn encoding_size_hint<E: Encoder>( &mut self, encoder: &E, minimum_len: usize ) -> usize

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.

source

fn encode( &mut self, buffer: &mut Buffer<'_>, minimum_len: usize, header_len: usize, tag_len: usize )

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

Object Safety§

This trait is not object safe.

Implementors§