|
|
@ -7,8 +7,6 @@ use super::frame::CloseFrame; |
|
|
|
use crate::error::{Error, Result}; |
|
|
|
use crate::error::{Error, Result}; |
|
|
|
|
|
|
|
|
|
|
|
mod string_collect { |
|
|
|
mod string_collect { |
|
|
|
|
|
|
|
|
|
|
|
use utf8; |
|
|
|
|
|
|
|
use utf8::DecodeError; |
|
|
|
use utf8::DecodeError; |
|
|
|
|
|
|
|
|
|
|
|
use crate::error::{Error, Result}; |
|
|
|
use crate::error::{Error, Result}; |
|
|
@ -202,42 +200,27 @@ impl Message { |
|
|
|
|
|
|
|
|
|
|
|
/// Indicates whether a message is a text message.
|
|
|
|
/// Indicates whether a message is a text message.
|
|
|
|
pub fn is_text(&self) -> bool { |
|
|
|
pub fn is_text(&self) -> bool { |
|
|
|
match *self { |
|
|
|
matches!(*self, Message::Text(_)) |
|
|
|
Message::Text(_) => true, |
|
|
|
|
|
|
|
_ => false, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Indicates whether a message is a binary message.
|
|
|
|
/// Indicates whether a message is a binary message.
|
|
|
|
pub fn is_binary(&self) -> bool { |
|
|
|
pub fn is_binary(&self) -> bool { |
|
|
|
match *self { |
|
|
|
matches!(*self, Message::Binary(_)) |
|
|
|
Message::Binary(_) => true, |
|
|
|
|
|
|
|
_ => false, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Indicates whether a message is a ping message.
|
|
|
|
/// Indicates whether a message is a ping message.
|
|
|
|
pub fn is_ping(&self) -> bool { |
|
|
|
pub fn is_ping(&self) -> bool { |
|
|
|
match *self { |
|
|
|
matches!(*self, Message::Ping(_)) |
|
|
|
Message::Ping(_) => true, |
|
|
|
|
|
|
|
_ => false, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Indicates whether a message is a pong message.
|
|
|
|
/// Indicates whether a message is a pong message.
|
|
|
|
pub fn is_pong(&self) -> bool { |
|
|
|
pub fn is_pong(&self) -> bool { |
|
|
|
match *self { |
|
|
|
matches!(*self, Message::Pong(_)) |
|
|
|
Message::Pong(_) => true, |
|
|
|
|
|
|
|
_ => false, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Indicates whether a message ia s close message.
|
|
|
|
/// Indicates whether a message ia s close message.
|
|
|
|
pub fn is_close(&self) -> bool { |
|
|
|
pub fn is_close(&self) -> bool { |
|
|
|
match *self { |
|
|
|
matches!(*self, Message::Close(_)) |
|
|
|
Message::Close(_) => true, |
|
|
|
|
|
|
|
_ => false, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Get the length of the WebSocket message.
|
|
|
|
/// Get the length of the WebSocket message.
|
|
|
|