enum WebSocketState {
Active,
ClosedByUs,
ClosedByPeer,
CloseAcknowledged,
Terminated,
}
Expand description
The current connection state.
Variants§
Active
The connection is active.
ClosedByUs
We initiated a close handshake.
ClosedByPeer
The peer initiated a close handshake.
CloseAcknowledged
The peer replied to our close handshake.
Terminated
The connection does not exist anymore.
Implementations§
source§impl WebSocketState
impl WebSocketState
sourcefn can_read(self) -> bool
fn can_read(self) -> bool
Tell if we should process incoming data. Note that if we send a close frame but the remote hasn’t confirmed, they might have sent data before they receive our close frame, so we should still pass those to client code, hence ClosedByUs is valid.
sourcefn check_not_terminated(self) -> Result<()>
fn check_not_terminated(self) -> Result<()>
Check if the state is active, return error if not.
Trait Implementations§
source§impl Clone for WebSocketState
impl Clone for WebSocketState
source§fn clone(&self) -> WebSocketState
fn clone(&self) -> WebSocketState
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for WebSocketState
impl Debug for WebSocketState
source§impl PartialEq for WebSocketState
impl PartialEq for WebSocketState
impl Copy for WebSocketState
impl Eq for WebSocketState
impl StructuralPartialEq for WebSocketState
Auto Trait Implementations§
impl Freeze for WebSocketState
impl RefUnwindSafe for WebSocketState
impl Send for WebSocketState
impl Sync for WebSocketState
impl Unpin for WebSocketState
impl UnwindSafe for WebSocketState
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)