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§
Required Methods§
Sourcefn feed(&mut self, bytes: &[u8]) -> Result<(), Self::Error>
fn feed(&mut self, bytes: &[u8]) -> Result<(), Self::Error>
Admits bytes into protocol-specific accumulation.
Sourcefn next_frame(&mut self) -> Result<Option<Self::Frame>, Self::Error>
fn next_frame(&mut self) -> Result<Option<Self::Frame>, Self::Error>
Extracts at most one complete frame while retaining later bytes.
Sourcefn retained_bytes(&self) -> RetainedBytes
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".