Expand description
An enum representing the various forms of a WebSocket message.
Variants
Text(String)
A text WebSocket message
Binary(Vec<u8>)
A binary WebSocket message
Implementations
sourceimpl Message
impl Message
sourcepub 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.
sourcepub fn binary<B>(bin: B) -> Message where
B: Into<Vec<u8>>,
pub fn binary<B>(bin: B) -> Message where
B: Into<Vec<u8>>,
Create a new binary WebSocket message by converting to Vec
sourcepub 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more