pub enum FrameError {
BadMagic,
BadVersion {
got: u8,
expected: u8,
},
BadHeaderCrc,
BadPayloadCrc,
OversizePayload {
len: u32,
max: u32,
},
ReservedNonZero,
Truncated {
have: usize,
need: usize,
},
}Expand description
Errors raised while decoding a frame off the wire. Each maps to a wire protocol-error condition; a mismatch is fail-stop for the connection (a corrupt frame desynchronizes the byte stream).
Variants§
BadMagic
First four bytes were not b"BRN0".
BadVersion
Version byte did not match WIRE_VERSION.
BadHeaderCrc
header_crc32c did not match the recomputed CRC.
BadPayloadCrc
payload_crc32c did not match the CRC of the payload bytes.
OversizePayload
payload_len exceeded the negotiated maximum — rejected before
any payload buffer is reserved, so a hostile length can’t force a
large allocation.
ReservedNonZero
A reserved header byte or reserved flag bit was non-zero.
Truncated
Not enough bytes buffered yet to decode the frame; caller should read more from the socket and retry.
Trait Implementations§
Source§impl Debug for FrameError
impl Debug for FrameError
Source§impl Display for FrameError
impl Display for FrameError
impl Eq for FrameError
Source§impl Error for FrameError
impl Error for FrameError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<FrameError> for BrainError
impl From<FrameError> for BrainError
Source§fn from(source: FrameError) -> Self
fn from(source: FrameError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for FrameError
impl PartialEq for FrameError
impl StructuralPartialEq for FrameError
Auto Trait Implementations§
impl Freeze for FrameError
impl RefUnwindSafe for FrameError
impl Send for FrameError
impl Sync for FrameError
impl Unpin for FrameError
impl UnsafeUnpin for FrameError
impl UnwindSafe for FrameError
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