pub struct CloseReason {
pub code: u16,
pub reason: String,
}Expand description
Close frame reason
Fields§
§code: u16Close status code
reason: StringOptional reason string
Implementations§
Source§impl CloseReason
impl CloseReason
Sourcepub const GOING_AWAY: u16 = 1_001u16
pub const GOING_AWAY: u16 = 1_001u16
Going away (e.g., server shutdown)
Sourcepub const PROTOCOL_ERROR: u16 = 1_002u16
pub const PROTOCOL_ERROR: u16 = 1_002u16
Protocol error
Sourcepub const UNSUPPORTED: u16 = 1_003u16
pub const UNSUPPORTED: u16 = 1_003u16
Unsupported data
Sourcepub const INVALID_PAYLOAD: u16 = 1_007u16
pub const INVALID_PAYLOAD: u16 = 1_007u16
Invalid frame payload
Sourcepub fn is_valid_code(code: u16) -> bool
pub fn is_valid_code(code: u16) -> bool
Check if the close code is valid per RFC 6455
Trait Implementations§
Source§impl Clone for CloseReason
impl Clone for CloseReason
Source§fn clone(&self) -> CloseReason
fn clone(&self) -> CloseReason
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for CloseReason
impl RefUnwindSafe for CloseReason
impl Send for CloseReason
impl Sync for CloseReason
impl Unpin for CloseReason
impl UnwindSafe for CloseReason
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