[][src]Struct seed::browser::web_socket::WebSocketMessage

pub struct WebSocketMessage { /* fields omitted */ }

Implementations

impl WebSocketMessage[src]

pub fn text(&self) -> Result<String>[src]

Return message data as String.

Errors

Returns WebSocketError::TextError if data isn't a valid utf-8 string.

pub fn json<T: DeserializeOwned + 'static>(&self) -> Result<T>[src]

JSON parse message data into provided type.

Errors

Returns

  • WebSocketError::TextError if data isn't a valid utf-8 string.
  • WebSocketError::SerdeError when JSON decoding fails.

pub async fn bytes<'_>(&'_ self) -> Result<Vec<u8>>[src]

Return message data as Vec<u8>.

Errors

Returns:

  • WebSocketError::PromiseError when loading bytes from Blob fails.
  • WebSocketError::TextError if the message data isn't binary but also not a valid utf-8 string.

pub fn blob(self) -> Result<Blob>[src]

Return message data as Blob.

Errors

Returns WebSocketError::TextError if the message data is neither binary nor a valid utf-8 string.

pub fn contains_array_buffer(&self) -> bool[src]

Is message data ArrayBuffer?

pub fn contains_blob(&self) -> bool[src]

Is message data Blob?

pub fn contains_text(&self) -> bool[src]

Is message data String?

pub const fn raw_data(&self) -> &JsValue[src]

Get underlying data as wasm_bindgen::JsValue.

This is an escape path if current API can't handle your needs. Should you find yourself using it, please consider opening an issue.

pub const fn raw_message(&self) -> &MessageEvent[src]

Get underlying web_sys::MessageEvent.

This is an escape path if current API can't handle your needs. Should you find yourself using it, please consider opening an issue.

Trait Implementations

impl Debug for WebSocketMessage[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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<V, T> VZip<V> for T where
    V: MultiLane<T>,