Enum tungstenite::error::Error[][src]

pub enum Error {
    ConnectionClosed,
    AlreadyClosed,
    Io(Error),
    Capacity(Cow<'static, str>),
    Protocol(Cow<'static, str>),
    SendQueueFull(Message),
    Utf8,
    Url(Cow<'static, str>),
    Http(StatusCode),
    HttpFormat(Error),
}
Expand description

Possible WebSocket errors

Variants

ConnectionClosed

WebSocket connection closed normally. This informs you of the close. It’s not an error as such and nothing wrong happened.

This is returned as soon as the close handshake is finished (we have both sent and received a close frame) on the server end and as soon as the server has closed the underlying connection if this endpoint is a client.

Thus when you receive this, it is safe to drop the underlying connection.

Receiving this error means that the WebSocket object is not usable anymore and the only meaningful action with it is dropping it.

AlreadyClosed

Trying to work with already closed connection.

Trying to read or write after receiving ConnectionClosed causes this.

As opposed to ConnectionClosed, this indicates your code tries to operate on the connection when it really shouldn’t anymore, so this really indicates a programmer error on your part.

Io(Error)

Tuple Fields

0: Error

Input-output error. Apart from WouldBlock, these are generally errors with the underlying connection and you should probably consider them fatal.

Capacity(Cow<'static, str>)

Tuple Fields

0: Cow<'static, str>

Protocol(Cow<'static, str>)

Tuple Fields

0: Cow<'static, str>

Protocol violation.

SendQueueFull(Message)

Tuple Fields

Message send queue full.

Utf8

UTF coding error

Url(Cow<'static, str>)

Tuple Fields

0: Cow<'static, str>

Invalid URL.

Http(StatusCode)

Tuple Fields

HTTP error.

HttpFormat(Error)

Tuple Fields

0: Error

HTTP format error.

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Convert WouldBlock to None and don’t touch other errors.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.