Trait ratchet_ext::ExtensionEncoder
source · 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§
Required Methods§
sourcefn encode(
&mut self,
payload: &mut BytesMut,
header: &mut FrameHeader
) -> Result<(), Self::Error>
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.