pub struct CloseCode(pub u16);Expand description
A close status code.
A newtype rather than an enum because the range 3000–4999 belongs to the application and must survive a round trip unchanged.
Tuple Fields§
§0: u16Implementations§
Source§impl CloseCode
impl CloseCode
pub const NORMAL: CloseCode
pub const GOING_AWAY: CloseCode
pub const PROTOCOL_ERROR: CloseCode
pub const UNSUPPORTED: CloseCode
Sourcepub const NO_STATUS: CloseCode
pub const NO_STATUS: CloseCode
Never sent on the wire: it means “the peer closed without a code”.
pub const INVALID_PAYLOAD: CloseCode
pub const POLICY: CloseCode
pub const TOO_LARGE: CloseCode
pub const INTERNAL_ERROR: CloseCode
pub fn code(self) -> u16
Sourcepub fn is_sendable(self) -> bool
pub fn is_sendable(self) -> bool
Whether this code is one a peer is allowed to put in a close frame.
1005, 1006 and 1015 describe how a connection ended locally; sending one is a protocol violation, and clients do occasionally try.
Trait Implementations§
impl Copy for CloseCode
impl Eq for CloseCode
impl StructuralPartialEq for CloseCode
Auto Trait Implementations§
impl Freeze 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
Mutably borrows from an owned value. Read more