Skip to main content

WsEvent

Enum WsEvent 

Source
pub enum WsEvent<'a> {
    Data {
        text: bool,
        payload: &'a [u8],
        fin: bool,
    },
    Ping(&'a [u8]),
    Pong(&'a [u8]),
    Close {
        code: Option<u16>,
        reason: &'a str,
    },
    NeedMore,
}
Expand description

One decoded event.

Variants§

§

Data

A piece of a data message, unmasked. fin marks the message’s last piece; text tells the message type. Pieces of a text message may split a UTF-8 sequence; the message as a whole is checked.

Fields

§text: bool

Text (true) or binary message.

§payload: &'a [u8]

The bytes.

§fin: bool

Last piece of the message.

§

Ping(&'a [u8])

A ping; answer with a pong carrying the same payload.

§

Pong(&'a [u8])

A pong.

§

Close

A close, with the code and reason if present; answer with a close and stop.

Fields

§code: Option<u16>

The status code.

§reason: &'a str

The reason, UTF-8.

§

NeedMore

More bytes are needed.

Trait Implementations§

Source§

impl<'a> Debug for WsEvent<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Eq for WsEvent<'a>

Source§

impl<'a> PartialEq for WsEvent<'a>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for WsEvent<'a>

Auto Trait Implementations§

§

impl<'a> Forget for WsEvent<'a>

§

impl<'a> Freeze for WsEvent<'a>

§

impl<'a> Move for WsEvent<'a>

§

impl<'a> RefUnwindSafe for WsEvent<'a>

§

impl<'a> Send for WsEvent<'a>

§

impl<'a> Sync for WsEvent<'a>

§

impl<'a> Unpin for WsEvent<'a>

§

impl<'a> UnsafeUnpin for WsEvent<'a>

§

impl<'a> UnwindSafe for WsEvent<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.