pub enum Message {
Text(Utf8Bytes),
Binary(Bytes),
Ping(Bytes),
Pong(Bytes),
Close(Option<CloseFrame>),
Frame(Frame),
}Expand description
A WebSocket message
Variants§
Text(Utf8Bytes)
A text message
Binary(Bytes)
A binary message
Ping(Bytes)
A ping (control) message
Pong(Bytes)
A pong (control) message
Close(Option<CloseFrame>)
A close (control) message
Frame(Frame)
Raw frame
Implementations§
Source§impl Message
impl Message
Sourcepub fn new_text<S>(string: S) -> Message
pub fn new_text<S>(string: S) -> Message
Create a new text WebSocket message from a stringable.
Sourcepub fn new_binary<B>(binary: B) -> Message
pub fn new_binary<B>(binary: B) -> Message
Create a new binary WebSocket message by converting to Bytes.
Sourcepub fn is_control(&self) -> bool
pub fn is_control(&self) -> bool
Indicates if the Message is of control protocol (Ping, Pong, Close)
Trait Implementations§
impl 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<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