pub struct Message { /* private fields */ }Available on crate feature
websocket only.Expand description
A WebSocket message.
This will likely become a non-exhaustive enum in the future, once that
language feature has stabilized.
Implementations§
Source§impl Message
impl Message
Sourcepub fn close_with(code: impl Into<u16>, reason: impl Into<Utf8Bytes>) -> Message
pub fn close_with(code: impl Into<u16>, reason: impl Into<Utf8Bytes>) -> Message
Construct a Close Message with a code and reason.
Sourcepub fn close_frame(&self) -> Option<(u16, &str)>
pub fn close_frame(&self) -> Option<(u16, &str)>
Try to get the close frame (close code and reason).
Trait Implementations§
Source§impl Sink<Message> for WebSocket
impl Sink<Message> for WebSocket
Source§fn poll_ready(
self: Pin<&mut WebSocket>,
cx: &mut Context<'_>,
) -> Poll<Result<(), <WebSocket as Sink<Message>>::Error>>
fn poll_ready( self: Pin<&mut WebSocket>, cx: &mut Context<'_>, ) -> Poll<Result<(), <WebSocket as Sink<Message>>::Error>>
Attempts to prepare the
Sink to receive a value. Read moreSource§fn start_send(
self: Pin<&mut WebSocket>,
item: Message,
) -> Result<(), <WebSocket as Sink<Message>>::Error>
fn start_send( self: Pin<&mut WebSocket>, item: Message, ) -> Result<(), <WebSocket as Sink<Message>>::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 Eq for Message
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl !Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.