[][src]Enum stdweb::web::event::SocketMessageData

pub enum SocketMessageData {
    Text(String),
    Blob(Blob),
    ArrayBuffer(ArrayBuffer),
}

Represents the types of data which can be received on a web socket. Messages are transmitted tagged as either binary or text: text messages are always received as strings. Binary messages may be received as either blobs or array buffers as preferred by the receiver. This choice is indicated via the binary_type field on the web socket.

Variants

Text(String)

Text message

Blob(Blob)

Binary message received as a blob

ArrayBuffer(ArrayBuffer)

Binary message received as an array buffer

Methods

impl SocketMessageData[src]

pub fn into_text(self) -> Option<String>[src]

Try to receive the message as text

pub fn into_blob(self) -> Option<Blob>[src]

Try to receive the message as a binary blob

pub fn into_array_buffer(self) -> Option<ArrayBuffer>[src]

Try to receive the message as an array buffer

Trait Implementations

impl TryFrom<Value> for SocketMessageData[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl Clone for SocketMessageData[src]

impl Debug for SocketMessageData[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]