pub enum SocketError<E> {
AppSpecific(E),
Request(RequestError),
Binary(Error),
Json(Error),
WebSockets(Error),
UnsupportedMessageType,
Closed,
IncorrectMethod {
expected: Method,
actual: Method,
},
}Expand description
An error returned by a socket handler.
SocketError encapsulates application specific errors E returned by the user-installed
handler itself. It also includes errors in the socket protocol, such as failures to turn
messages sent by the user-installed handler into WebSockets messages.
Variants§
AppSpecific(E)
Request(RequestError)
Binary(Error)
Json(Error)
WebSockets(Error)
UnsupportedMessageType
Closed
IncorrectMethod
Implementations§
Source§impl<E> SocketError<E>
impl<E> SocketError<E>
pub fn status(&self) -> StatusCode
pub fn code(&self) -> CloseCode
pub fn map_app_specific<E2>(self, f: &impl Fn(E) -> E2) -> SocketError<E2>
Trait Implementations§
Source§impl<E: Debug> Debug for SocketError<E>
impl<E: Debug> Debug for SocketError<E>
Source§impl<E: Display> Display for SocketError<E>
impl<E: Display> Display for SocketError<E>
Source§impl<E> From<Error> for SocketError<E>
impl<E> From<Error> for SocketError<E>
Source§impl<E> From<Error> for SocketError<E>
impl<E> From<Error> for SocketError<E>
Source§impl<E> From<Error> for SocketError<E>
impl<E> From<Error> for SocketError<E>
Source§impl<E> From<RequestError> for SocketError<E>
impl<E> From<RequestError> for SocketError<E>
Source§fn from(err: RequestError) -> Self
fn from(err: RequestError) -> Self
Converts to this type from the input type.
Source§impl<E: Display> From<SocketError<E>> for ServerError
impl<E: Display> From<SocketError<E>> for ServerError
Source§fn from(source: SocketError<E>) -> Self
fn from(source: SocketError<E>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<E> Freeze for SocketError<E>where
E: Freeze,
impl<E> !RefUnwindSafe for SocketError<E>
impl<E> Send for SocketError<E>where
E: Send,
impl<E> Sync for SocketError<E>where
E: Sync,
impl<E> Unpin for SocketError<E>where
E: Unpin,
impl<E> !UnwindSafe for SocketError<E>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more