pub enum Framed<T> {
Msg(T),
Undecodable {
reason: String,
len: usize,
},
}Expand description
Outcome of reading one frame off the wire.
The distinction this type draws is the load-bearing one: a
payload we could not understand is not the same event as a
stream we could not read. The first leaves the connection
perfectly usable and deserves an answer; the second does not.
Collapsing them into one io::Error is what made an unknown
request variant hang up the socket.
Variants§
Msg(T)
A complete frame that decoded into T.
Undecodable
A complete frame — length prefix honoured, every one of its
bytes consumed — whose payload did not decode into T. The
canonical cause is a variant from a newer peer’s vocabulary.
The stream is still aligned at the next frame boundary,
so the reader may reply and keep reading. Verified by
an_undecodable_frame_leaves_the_stream_aligned.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Framed<T>where
T: Freeze,
impl<T> RefUnwindSafe for Framed<T>where
T: RefUnwindSafe,
impl<T> Send for Framed<T>where
T: Send,
impl<T> Sync for Framed<T>where
T: Sync,
impl<T> Unpin for Framed<T>where
T: Unpin,
impl<T> UnsafeUnpin for Framed<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Framed<T>where
T: UnwindSafe,
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