pub fn into_bytes(self) -> Result<Bytes, CommandError> {
        Ok(match self {
            Op::INFO(si) => si.into_vec()?,
            Op::CONNECT(con) => con.into_vec()?,
            Op::PUB(pc) => pc.into_vec()?,
            Op::SUB(sc) => sc.into_vec()?,
            Op::UNSUB(uc) => uc.into_vec()?,
            Op::MSG(msg) => msg.into_vec()?,
            Op::PING => "PING\r\n".into(),
            Op::PONG => "PONG\r\n".into(),
            Op::OK => "+OK\r\n".into(),
            Op::ERR(se) => format!("-ERR {}\r\n", se).as_bytes().into(),
        })
    }
/// Transforms the OP into a byte slice
Transforms the OP into a byte slice
Transforms the OP into a byte slice
pub fn into_bytes(self) -> Result<Bytes, CommandError> {
        Ok(match self {
            Op::INFO(si) => si.into_vec()?,
            Op::CONNECT(con) => con.into_vec()?,
            Op::PUB(pc) => pc.into_vec()?,
            Op::SUB(sc) => sc.into_vec()?,
            Op::UNSUB(uc) => uc.into_vec()?,
            Op::MSG(msg) => msg.into_vec()?,
            Op::PING => "PING\r\n".into(),
            Op::PONG => "PONG\r\n".into(),
            Op::OK => "+OK\r\n".into(),
            Op::ERR(se) => format!("-ERR {}\r\n", se).as_bytes().into(),
        })
    }
pub fn into_bytes ( self ) -> Result < Bytes , CommandError > { Ok ( match self { Op :: INFO ( si ) => si . into_vec ( ) ? , Op :: CONNECT ( con ) => con . into_vec ( ) ? , Op :: PUB ( pc ) => pc . into_vec ( ) ? , Op :: SUB ( sc ) => sc . into_vec ( ) ? , Op :: UNSUB ( uc ) => uc . into_vec ( ) ? , Op :: MSG ( msg ) => msg . into_vec ( ) ? , Op :: PING => " \r \n " . into ( ) , Op :: PONG => " \r \n " . into ( ) , Op :: OK => " \r \n " . into ( ) , Op :: ERR ( se ) => format ! ( " \r \n " se ) . as_bytes ( ) . into ( ) , } ) }
Transforms the OP into a byte slice
Transforms the OP into a byte slice
self
self