pub enum MessageType {
Text,
Binary,
Ping,
Pong,
Close,
}Available on crate feature
websocket only.Expand description
Enumeration of WebSocket message types.
This enum provides a way to identify the type of a message without accessing its contents. It’s useful for routing logic, statistics, and protocol handling.
§Examples
use ignitia::websocket::{Message, MessageType};
let message = Message::text("Hello");
match message.message_type() {
MessageType::Text => println!("It's a text message"),
MessageType::Binary => println!("It's a binary message"),
MessageType::Ping => println!("It's a ping frame"),
MessageType::Pong => println!("It's a pong frame"),
MessageType::Close => println!("It's a close frame"),
}Variants§
Text
Text message type
Binary
Binary message type
Ping
Ping frame type
Pong
Pong frame type
Close
Close frame type
Trait Implementations§
Source§impl Clone for MessageType
impl Clone for MessageType
Source§fn clone(&self) -> MessageType
fn clone(&self) -> MessageType
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MessageType
impl Debug for MessageType
Source§impl PartialEq for MessageType
impl PartialEq for MessageType
impl StructuralPartialEq for MessageType
Auto Trait Implementations§
impl Freeze for MessageType
impl RefUnwindSafe for MessageType
impl Send for MessageType
impl Sync for MessageType
impl Unpin for MessageType
impl UnwindSafe for MessageType
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