create_enum! {
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum OpCode<u8> {
Continuation = (0b0000_0000),
Text = (0b0000_0001),
Binary = (0b0000_0010),
Close = (0b0000_1000),
Ping = (0b0000_1001),
Pong = (0b0000_1010),
}
}
impl OpCode {
#[inline]
pub const fn is_close(self) -> bool {
matches!(self, OpCode::Close)
}
pub(crate) const fn is_control(self) -> bool {
matches!(self, OpCode::Close | OpCode::Ping | OpCode::Pong)
}
pub(crate) const fn is_text(self) -> bool {
matches!(self, OpCode::Text)
}
}