pub struct FrameCodec { /* private fields */ }Expand description
基于 length_codec 的帧解码器,用于读取 Python 的 stdout。
对于完整但非法的帧(JSON 错误、未知消息类型、字段缺失),解码结果为 Ok(Err(_)):
此时数据流仍对齐在帧边界上,可以继续读取。Err(_) 是致命错误,其中包括长度前缀超限时的
ProtocolError::TooLarge:双方在发送前都会检查大小,出现超限帧说明对端已损坏,因此不跳过。
Implementations§
Trait Implementations§
Source§impl Decoder for FrameCodec
impl Decoder for FrameCodec
Source§type Error = ProtocolError
type Error = ProtocolError
The type of unrecoverable frame decoding errors. Read more
Source§fn decode(
&mut self,
src: &mut BytesMut,
) -> Result<Option<Self::Item>, ProtocolError>
fn decode( &mut self, src: &mut BytesMut, ) -> Result<Option<Self::Item>, ProtocolError>
Attempts to decode a frame from the provided buffer of bytes. Read more
Auto Trait Implementations§
impl Forget for FrameCodec
impl Freeze for FrameCodec
impl Move for FrameCodec
impl RefUnwindSafe for FrameCodec
impl Send for FrameCodec
impl Sync for FrameCodec
impl Unpin for FrameCodec
impl UnsafeUnpin for FrameCodec
impl UnwindSafe for FrameCodec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more