pub enum Message {
Text(String),
Binary(Vec<u8>),
Ping(Vec<u8>),
Pong(Vec<u8>),
Close,
}Expand description
Message structure contained in a frame
Variants§
Text(String)
Text message
Binary(Vec<u8>)
Binary message
Ping(Vec<u8>)
Ping message
Pong(Vec<u8>)
Pong message
Close
Close message
Implementations§
Source§impl Message
impl Message
Sourcepub fn text<A: Into<String>>(text: A) -> Message
pub fn text<A: Into<String>>(text: A) -> Message
Geneates an instances of the Message::Text variant
Sourcepub fn binary<A: Into<Vec<u8>>>(bytes: A) -> Message
pub fn binary<A: Into<Vec<u8>>>(bytes: A) -> Message
Geneates an instances of the Message::Binary variant
Sourcepub fn ping<A: Into<Vec<u8>>>(payload: A) -> Message
pub fn ping<A: Into<Vec<u8>>>(payload: A) -> Message
Geneates an instances of the Message::Binary variant
Sourcepub fn pong<A: Into<Vec<u8>>>(payload: A) -> Message
pub fn pong<A: Into<Vec<u8>>>(payload: A) -> Message
Geneates an instances of the Message::Binary variant
Sourcepub fn is_close(&self) -> bool
pub fn is_close(&self) -> bool
Indicates if the variant equates de Message::Close variant
Sourcepub fn is_ping(&self) -> bool
pub fn is_ping(&self) -> bool
Indicates if the variant equates de Message::Ping variant
Sourcepub fn is_pong(&self) -> bool
pub fn is_pong(&self) -> bool
Indicates if the variant equates de Message::Pong variant
Trait Implementations§
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