Enum tide_websockets::Error[]

pub enum Error {
    ConnectionClosed,
    AlreadyClosed,
    Io(Error),
    Tls(TlsError),
    Capacity(CapacityError),
    Protocol(ProtocolError),
    SendQueueFull(Message),
    Utf8,
    Url(UrlError),
    Http(Response<Option<String>>),
    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)

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

Tls(TlsError)

TLS error.

Note that this error variant is enabled unconditionally even if no TLS feature is enabled, to provide a feature-agnostic API surface.

Capacity(CapacityError)
  • When reading: buffer capacity exhausted.
  • When writing: your message is bigger than the configured max message size (64MB by default).
Protocol(ProtocolError)

Protocol violation.

SendQueueFull(Message)

Message send queue full.

Utf8

UTF coding error.

Url(UrlError)

Invalid URL.

HTTP error.

HttpFormat(Error)

HTTP format error.

Trait Implementations

impl Debug for Error

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl Display for Error

pub fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl Error for Error

pub fn source(&self) -> Option<&(dyn Error + 'static)>

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

fn backtrace(&self) -> Option<&Backtrace>[src]

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

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

fn description(&self) -> &str1.0.0[src]

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

fn cause(&self) -> Option<&dyn Error>1.0.0[src]

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

impl From<Error> for Error

pub fn from(source: Error) -> Error

Performs the conversion.

impl From<Error> for Error

pub fn from(source: Error) -> Error

Performs the conversion.

impl From<Error> for Error

pub fn from(err: Error) -> Error

Performs the conversion.

impl From<FromUtf8Error> for Error

pub fn from(FromUtf8Error) -> Error

Performs the conversion.

impl From<InvalidHeaderName> for Error

pub fn from(err: InvalidHeaderName) -> Error

Performs the conversion.

impl From<InvalidHeaderValue> for Error

pub fn from(err: InvalidHeaderValue) -> Error

Performs the conversion.

impl From<InvalidStatusCode> for Error

pub fn from(err: InvalidStatusCode) -> Error

Performs the conversion.

impl From<InvalidUri> for Error

pub fn from(err: InvalidUri) -> Error

Performs the conversion.

impl From<TlsError> for Error

pub fn from(source: TlsError) -> Error

Performs the conversion.

impl From<ToStrError> for Error

pub fn from(ToStrError) -> Error

Performs the conversion.

impl From<Utf8Error> for Error

pub fn from(Utf8Error) -> Error

Performs the conversion.

impl NonBlockingError for Error

pub fn into_non_blocking(self) -> Option<Error>

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

Auto Trait Implementations

impl !RefUnwindSafe for Error

impl Send for Error

impl Sync for Error

impl Unpin for Error

impl !UnwindSafe for Error

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V