pub struct FrameReader { /* private fields */ }Expand description
Incremental frame reader that survives read timeouts.
read_frame uses read_exact, which discards bytes it already read when
a timeout fires mid-frame. The stream is then misaligned: the next read
parses payload bytes as a length prefix. FrameReader keeps the partial
frame, so a timeout returns WouldBlock/TimedOut with nothing lost and
the caller can retry, or give up once FrameReader::stalled_for is long.
Implementations§
Source§impl FrameReader
impl FrameReader
pub fn new() -> Self
Sourcepub fn in_progress(&self) -> bool
pub fn in_progress(&self) -> bool
True when part of a frame has been read and the rest is still due.
Sourcepub fn stalled_for(&self) -> Option<Duration>
pub fn stalled_for(&self) -> Option<Duration>
Time since the first byte of the frame in progress, if one is in progress.
Trait Implementations§
Source§impl Debug for FrameReader
impl Debug for FrameReader
Auto Trait Implementations§
impl Forget for FrameReader
impl Freeze for FrameReader
impl Move for FrameReader
impl RefUnwindSafe for FrameReader
impl Send for FrameReader
impl Sync for FrameReader
impl Unpin for FrameReader
impl UnsafeUnpin for FrameReader
impl UnwindSafe for FrameReader
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