[−][src]Struct seed::browser::web_socket::WebSocketMessage
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 fromBlob
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
Auto Trait Implementations
impl RefUnwindSafe for WebSocketMessage
impl !Send for WebSocketMessage
impl !Sync for WebSocketMessage
impl Unpin for WebSocketMessage
impl UnwindSafe for WebSocketMessage
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut Tⓘ
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,