pub enum Message<T> {
Item(T),
Ping(Vec<u8>),
Pong(Vec<u8>),
Close(Option<CloseFrame<'static>>),
}
Expand description
A WebSocket message contain a value of a known type.
Variants§
Item(T)
An item of type T
.
Ping(Vec<u8>)
A ping message with the specified payload
The payload here must have a length less than 125 bytes
Pong(Vec<u8>)
A pong message with the specified payload
The payload here must have a length less than 125 bytes
Close(Option<CloseFrame<'static>>)
A close message with the optional close frame.
Trait Implementations§
Source§impl<S, R, C> Sink<Message<S>> for WebSocket<S, R, C>
impl<S, R, C> Sink<Message<S>> for WebSocket<S, R, C>
Source§type Error = Error<<C as Codec>::Error>
type Error = Error<<C as Codec>::Error>
The type of value produced by the sink when an error occurs.
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>, msg: Message<S>) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, msg: Message<S>) -> 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 moreimpl<T: Eq> Eq for Message<T>
impl<T> StructuralPartialEq for Message<T>
Auto Trait Implementations§
impl<T> Freeze for Message<T>where
T: Freeze,
impl<T> RefUnwindSafe for Message<T>where
T: RefUnwindSafe,
impl<T> Send for Message<T>where
T: Send,
impl<T> Sync for Message<T>where
T: Sync,
impl<T> Unpin for Message<T>where
T: Unpin,
impl<T> UnwindSafe for Message<T>where
T: UnwindSafe,
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