#[non_exhaustive]pub struct WebSocketError(/* private fields */);Expand description
WebSocket transport error reported by the underlying WebSocket client.
As with HttpError, the inner third-party type is private and
diagnostics are exposed via accessor methods returning primitive types.
Implementations§
Source§impl WebSocketError
impl WebSocketError
Sourcepub fn is_connection_closed(&self) -> bool
pub fn is_connection_closed(&self) -> bool
true if the peer cleanly closed the connection.
Sourcepub fn is_already_closed(&self) -> bool
pub fn is_already_closed(&self) -> bool
true if the connection was already closed when the operation was
attempted (caller bug or race).
Sourcepub fn is_protocol(&self) -> bool
pub fn is_protocol(&self) -> bool
true if the error is a WebSocket protocol violation
(malformed frame, invalid opcode, etc.).
Sourcepub fn is_capacity(&self) -> bool
pub fn is_capacity(&self) -> bool
true if a frame or message exceeded a configured size limit.
Sourcepub fn kind(&self) -> WebSocketErrorKind
pub fn kind(&self) -> WebSocketErrorKind
Classify the error into a single category (bd:JMAP-6r7c.34).
Single-match alternative to the 6 is_*
boolean accessors. Returns a WebSocketErrorKind so a caller
can dispatch on the failure mode without chained-if-else.
Precedence (highest first): ConnectionClosed, AlreadyClosed,
Url, Protocol, Capacity, Io, Other. The first three
are exact tungstenite variants and are mutually exclusive;
the remainder follow the is_* accessor order from this file.
This method does not return retriability advice — make that
decision at the call site using the kind as input.
Trait Implementations§
Source§impl Debug for WebSocketError
impl Debug for WebSocketError
Source§impl Display for WebSocketError
impl Display for WebSocketError
Source§impl Error for WebSocketError
impl Error for WebSocketError
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for WebSocketError
impl !UnwindSafe for WebSocketError
impl Freeze for WebSocketError
impl Send for WebSocketError
impl Sync for WebSocketError
impl Unpin for WebSocketError
impl UnsafeUnpin for WebSocketError
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.