pub trait ExtensionEncoder {
    type Error: Error + Send + Sync + 'static;

    // Required method
    fn encode(
        &mut self,
        payload: &mut BytesMut,
        header: &mut FrameHeader
    ) -> Result<(), Self::Error>;
}
Expand description

A per-message frame encoder.

Required Associated Types§

source

type Error: Error + Send + Sync + 'static

The error type produced by this extension if encoding fails.

Required Methods§

source

fn encode( &mut self, payload: &mut BytesMut, header: &mut FrameHeader ) -> Result<(), Self::Error>

Invoked when a frame has been received.

Continuation frames

If this frame is not final or a continuation frame then payload will contain all of the data received up to and including this frame.

Note

If a condition is not met an implementation may opt to not encode this frame; such as the payload length not being large enough to require encoding.

Implementors§