pub struct CloseCode(/* private fields */);ws only.Expand description
Status code used to indicate why an endpoint is closing the WebSocket connection.
Implementations§
Source§impl CloseCode
Constants for CloseCodes.
impl CloseCode
Constants for CloseCodes.
Sourcepub const NORMAL: CloseCode
pub const NORMAL: CloseCode
Indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled.
Sourcepub const AWAY: CloseCode
pub const AWAY: CloseCode
Indicates that an endpoint is “going away”, such as a server going down or a browser having navigated away from a page.
Sourcepub const PROTOCOL: CloseCode
pub const PROTOCOL: CloseCode
Indicates that an endpoint is terminating the connection due to a protocol error.
Sourcepub const UNSUPPORTED: CloseCode
pub const UNSUPPORTED: CloseCode
Indicates that an endpoint is terminating the connection because it has received a type of data that it cannot accept.
For example, an endpoint MAY send this if it understands only text data, but receives a binary message.
Sourcepub const INVALID: CloseCode
pub const INVALID: CloseCode
Indicates that an endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message.
For example, an endpoint received non-UTF-8 RFC3629 data within a text message.
Sourcepub const POLICY: CloseCode
pub const POLICY: CloseCode
Indicates that an endpoint is terminating the connection because it has received a message that violates its policy.
This is a generic status code that can be returned when there is
no other more suitable status code (e.g., UNSUPPORTED or SIZE) or if there is a need to
hide specific details about the policy.
Sourcepub const SIZE: CloseCode
pub const SIZE: CloseCode
Indicates that an endpoint is terminating the connection because it has received a message that is too big for it to process.
Sourcepub const EXTENSION: CloseCode
pub const EXTENSION: CloseCode
Indicates that an endpoint (client) is terminating the connection because the server did not respond to extension negotiation correctly.
Specifically, the client has expected the server to negotiate one or more extension(s), but the server didn’t return them in the response message of the WebSocket handshake. The list of extensions that are needed should be given as the reason for closing. Note that this status code is not used by the server, because it can fail the WebSocket handshake instead.
Trait Implementations§
impl Eq for CloseCode
impl StructuralPartialEq for CloseCode
Auto Trait Implementations§
impl Forget for CloseCode
impl Freeze for CloseCode
impl Move for CloseCode
impl RefUnwindSafe for CloseCode
impl Send for CloseCode
impl Sync for CloseCode
impl Unpin for CloseCode
impl UnsafeUnpin for CloseCode
impl UnwindSafe for CloseCode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> ⓘ
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> ⓘ
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