pub trait Framer {
// Required method
fn next_frame<B: ReadIoBuffer>(
&mut self,
buf: &mut B,
is_eof: bool,
) -> Result<Option<Bytes>, FramingError>;
}
Expand description
A trait for reading framed messages from a buffer.
Required Methods§
Sourcefn next_frame<B: ReadIoBuffer>(
&mut self,
buf: &mut B,
is_eof: bool,
) -> Result<Option<Bytes>, FramingError>
fn next_frame<B: ReadIoBuffer>( &mut self, buf: &mut B, is_eof: bool, ) -> Result<Option<Bytes>, FramingError>
Attempt to extract the next frame from the buffer.
If enough data was present to extract a frame, Ok(Some(frame))
is returned. If not enough data was present, and
EOF has not been reached, Ok(None)
is returned.
Behavior when EOF is reached is framer-specific and in some cases may allow for decoding a frame even when the inherent delimiting data is not present.
§Errors
If an error is detected when reading the next frame, an error is returned.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.