Enum tide_websockets::Message [−]
pub enum Message { Text(String), Binary(Vec<u8, Global>), Ping(Vec<u8, Global>), Pong(Vec<u8, Global>), Close(Option<CloseFrame<'static>>), }
Expand description
An enum representing the various forms of a WebSocket message.
Variants
Text(String)
A text WebSocket message
A binary WebSocket message
A ping message with the specified payload
The payload here must have a length less than 125 bytes
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.
Implementations
impl Message
impl Message
pub fn text<S>(string: S) -> Message where
S: Into<String>,
pub fn text<S>(string: S) -> Message where
S: Into<String>,
Create a new text WebSocket message from a stringable.
pub fn binary<B>(bin: B) -> Message where
B: Into<Vec<u8, Global>>,
pub fn binary<B>(bin: B) -> Message where
B: Into<Vec<u8, Global>>,
Create a new binary WebSocket message by converting to Vec
pub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the WebSocket message has no content. For example, if the other side of the connection sent an empty string.
Trait Implementations
impl Eq for Message
impl StructuralEq for Message
impl StructuralPartialEq for Message
Auto Trait Implementations
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,