pub enum WsMessage {
Text(String),
Binary(Vec<u8>),
}
Expand description
Represents a WebSocket Message, after converting from JavaScript type.
Variants§
Trait Implementations§
Source§impl Sink<WsMessage> for WsStream
impl Sink<WsMessage> for WsStream
Source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Attempts to prepare the
Sink
to receive a value. Read moreSource§fn start_send(self: Pin<&mut Self>, item: WsMessage) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, item: WsMessage) -> Result<(), Self::Error>
Begin the process of sending a value to the sink.
Each call to this function must be preceded by a successful call to
poll_ready
which returned Poll::Ready(Ok(()))
. Read moreSource§impl TryFrom<MessageEvent> for WsMessage
This will convert the JavaScript event into a WsMessage. Note that this
will only work if the connection is set to use the binary type ArrayBuffer.
On binary type Blob, this will panic.
impl TryFrom<MessageEvent> for WsMessage
This will convert the JavaScript event into a WsMessage. Note that this will only work if the connection is set to use the binary type ArrayBuffer. On binary type Blob, this will panic.
impl Eq for WsMessage
impl StructuralPartialEq for WsMessage
Auto Trait Implementations§
impl Freeze for WsMessage
impl RefUnwindSafe for WsMessage
impl Send for WsMessage
impl Sync for WsMessage
impl Unpin for WsMessage
impl UnwindSafe for WsMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more