Skip to main content

FrameDecoder

Trait FrameDecoder 

Source
pub trait FrameDecoder {
    type Frame;
    type Error;

    // Required methods
    fn feed(&mut self, bytes: &[u8]) -> Result<(), Self::Error>;
    fn next_frame(&mut self) -> Result<Option<Self::Frame>, Self::Error>;
    fn retained_bytes(&self) -> RetainedBytes;
}
Expand description

Protocol-owned incremental decoding of complete inbound frames.

Implementations retain one bounded stream accumulation rather than an unreported queue of decoded frames. Callers drain next_frame after each accepted input before admitting more bytes.

Required Associated Types§

Source

type Frame

Complete opaque frame emitted to inbound classification.

Source

type Error

Protocol-specific terminal decoder error.

Required Methods§

Source

fn feed(&mut self, bytes: &[u8]) -> Result<(), Self::Error>

Admits bytes into protocol-specific accumulation.

Source

fn next_frame(&mut self) -> Result<Option<Self::Frame>, Self::Error>

Extracts at most one complete frame while retaining later bytes.

Source

fn retained_bytes(&self) -> RetainedBytes

Reports all variable memory currently retained by the decoder.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§