Skip to main content

CloseReason

Trait CloseReason 

Source
pub trait CloseReason {
    type Bytes;

    // Required method
    fn to_bytes(self) -> Self::Bytes;
}
Expand description

This trait is responsible for encoding websocket closed frame.

Required Associated Types§

Source

type Bytes

Encoded close reason as bytes

Required Methods§

Source

fn to_bytes(self) -> Self::Bytes

Encode websocket close frame.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl CloseReason for &str

Source§

type Bytes = Vec<u8>

Source§

fn to_bytes(self) -> Self::Bytes

Source§

impl CloseReason for u16

Source§

type Bytes = [u8; 2]

Source§

fn to_bytes(self) -> Self::Bytes

Source§

impl CloseReason for ()

Source§

type Bytes = [u8; 0]

Source§

fn to_bytes(self) -> Self::Bytes

Source§

impl<Code, Msg> CloseReason for (Code, Msg)
where Code: Into<u16>, Msg: AsRef<[u8]>,

Source§

type Bytes = Vec<u8>

Source§

fn to_bytes(self) -> Self::Bytes

Implementors§