#[repr(u8)]pub enum WebSocketOpcode {
Continuation = 0,
Text = 1,
Binary = 2,
Close = 8,
Ping = 9,
Pong = 10,
Reserved(u8),
}
Expand description
WebSocket frame opcode types
Variants§
Continuation = 0
Continuation frame (0x0)
Text = 1
Text frame (0x1)
Binary = 2
Binary frame (0x2)
Close = 8
Connection close frame (0x8)
Ping = 9
Ping frame (0x9)
Pong = 10
Pong frame (0xA)
Reserved(u8)
Reserved for future use
Implementations§
Source§impl WebSocketOpcode
impl WebSocketOpcode
Sourcepub fn from_u8(opcode: u8) -> WebSocketOpcode
pub fn from_u8(opcode: u8) -> WebSocketOpcode
Sourcepub fn is_control(&self) -> bool
pub fn is_control(&self) -> bool
Check if the opcode is a control frame
§Returns
- true if the opcode represents a control frame (Close, Ping, Pong)
- false otherwise
Sourcepub fn is_data(&self) -> bool
pub fn is_data(&self) -> bool
Check if the opcode is a data frame
§Returns
- true if the opcode represents a data frame (Text, Binary, Continuation)
- false otherwise
Sourcepub fn is_continuation(&self) -> bool
pub fn is_continuation(&self) -> bool
Sourcepub fn is_reserved(&self) -> bool
pub fn is_reserved(&self) -> bool
Trait Implementations§
Source§impl Clone for WebSocketOpcode
impl Clone for WebSocketOpcode
Source§fn clone(&self) -> WebSocketOpcode
fn clone(&self) -> WebSocketOpcode
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 WebSocketOpcode
impl Debug for WebSocketOpcode
Source§impl PartialEq for WebSocketOpcode
impl PartialEq for WebSocketOpcode
impl Copy for WebSocketOpcode
impl Eq for WebSocketOpcode
impl StructuralPartialEq for WebSocketOpcode
Auto Trait Implementations§
impl Freeze for WebSocketOpcode
impl RefUnwindSafe for WebSocketOpcode
impl Send for WebSocketOpcode
impl Sync for WebSocketOpcode
impl Unpin for WebSocketOpcode
impl UnwindSafe for WebSocketOpcode
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