#[non_exhaustive]pub enum ProtocolError {
FrameTooLarge(u64),
Malformed(String),
Version(VersionMismatch),
Reply {
code: ErrorCode,
message: String,
},
}Expand description
Framing, JSON and version errors, and error replies from the peer.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
FrameTooLarge(u64)
A frame’s length is over crate::MAX_FRAME_BYTES.
Malformed(String)
A frame or its JSON could not be read. JSON errors are carried as text, because this crate does not depend on a JSON library.
Version(VersionMismatch)
The peer speaks another major version.
Reply
The peer answered with an error.
Trait Implementations§
Source§impl Clone for ProtocolError
impl Clone for ProtocolError
Source§impl Debug for ProtocolError
impl Debug for ProtocolError
Source§impl Display for ProtocolError
impl Display for ProtocolError
Source§impl Error for ProtocolError
impl Error for ProtocolError
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<ErrorBody> for ProtocolError
impl From<ErrorBody> for ProtocolError
Source§impl From<VersionMismatch> for ProtocolError
impl From<VersionMismatch> for ProtocolError
Source§fn from(source: VersionMismatch) -> Self
fn from(source: VersionMismatch) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ProtocolError
impl PartialEq for ProtocolError
impl StructuralPartialEq for ProtocolError
Auto Trait Implementations§
impl Forget for ProtocolError
impl Freeze for ProtocolError
impl Move for ProtocolError
impl RefUnwindSafe for ProtocolError
impl Send for ProtocolErrorwhere
RawVecInner: Send,
impl Sync for ProtocolErrorwhere
RawVecInner: Sync,
impl Unpin for ProtocolError
impl UnsafeUnpin for ProtocolError
impl UnwindSafe for ProtocolErrorwhere
RawVecInner: 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