Struct warp::filters::ws::Message [−][src]
pub struct Message { /* fields omitted */ }
A WebSocket message.
Only repesents Text and Binary messages.
This will likely become a non-exhaustive
enum in the future, once that
language feature has stabilized.
Methods
impl Message
[src]
impl Message
pub fn text<S: Into<String>>(s: S) -> Message
[src]
pub fn text<S: Into<String>>(s: S) -> Message
Construct a new Text Message
.
pub fn binary<V: Into<Vec<u8>>>(v: V) -> Message
[src]
pub fn binary<V: Into<Vec<u8>>>(v: V) -> Message
Construct a new Binary Message
.
pub fn is_text(&self) -> bool
[src]
pub fn is_text(&self) -> bool
Returns true if this message is a Text message.
pub fn is_binary(&self) -> bool
[src]
pub fn is_binary(&self) -> bool
Returns true if this message is a Binary message.
pub fn to_str(&self) -> Result<&str, ()>
[src]
pub fn to_str(&self) -> Result<&str, ()>
Try to get a reference to the string text, if this is a Text message.
pub fn as_bytes(&self) -> &[u8]
[src]
pub fn as_bytes(&self) -> &[u8]
Return the bytes of this message.