pub fn send_req(&self, buf: &mut BytesMut) -> Result<(), AsError> {
        if self.is_ask() {
            buf.extend_from_slice(BYTES_ASK);
        }

        if self.ctype.is_exists() || self.ctype.is_del() {
            buf.extend_from_slice(BYTES_LEN2_HEAD);
            if let RespType::Array(_, arrs) = &self.req.rtype {
                for rtype in arrs {
                    self.req.save_by_rtype(rtype, buf);
                }
            }
            return Ok(());
        } else if self.ctype.is_mset() {
            buf.extend_from_slice(BYTES_LEN3_HEAD);
            if let RespType::Array(_, arrs) = &self.req.rtype {
                for rtype in arrs {
                    self.req.save_by_rtype(rtype, buf);
                }
            }
            return Ok(());
        } else if self.ctype.is_mget() {
            buf.extend_from_slice(BYTES_LEN2_HEAD);
            buf.extend_from_slice(BYTES_GET);

            if let RespType::Array(_, arrs) = &self.req.rtype {
                for rtype in &arrs[1..] {
                    self.req.save_by_rtype(rtype, buf);
                }
            }
            return Ok(());
        }
        self.req.save(buf);
        Ok(())
    }
/// save redis Command into given BytesMut
save redis Command into given BytesMut
save redis Command into given BytesMut
pub fn send_req(&self, buf: &mut BytesMut) -> Result<(), AsError> {
        if self.is_ask() {
            buf.extend_from_slice(BYTES_ASK);
        }
        if self.ctype.is_exists() || self.ctype.is_del() {
            buf.extend_from_slice(BYTES_LEN2_HEAD);
            if let RespType::Array(_, arrs) = &self.req.rtype {
                for rtype in arrs {
                    self.req.save_by_rtype(rtype, buf);
                }
            }
            return Ok(());
        } else if self.ctype.is_mset() {
            buf.extend_from_slice(BYTES_LEN3_HEAD);
            if let RespType::Array(_, arrs) = &self.req.rtype {
                for rtype in arrs {
                    self.req.save_by_rtype(rtype, buf);
                }
            }
            return Ok(());
        } else if self.ctype.is_mget() {
            buf.extend_from_slice(BYTES_LEN2_HEAD);
            buf.extend_from_slice(BYTES_GET);
            if let RespType::Array(_, arrs) = &self.req.rtype {
                for rtype in &arrs[1..] {
                    self.req.save_by_rtype(rtype, buf);
                }
            }
            return Ok(());
        }
        self.req.save(buf);
        Ok(())
    }
pub fn send_req ( & self , buf : & mut BytesMut ) -> Result < ( ) , AsError > { if self . is_ask ( ) { buf . extend_from_slice ( BYTES_ASK ) ; } if self . ctype . is_exists ( ) || self . ctype . is_del ( ) { buf . extend_from_slice ( BYTES_LEN2_HEAD ) ; if let RespType :: Array ( _ , arrs ) = & self . req . rtype { for rtype in arrs { self . req . save_by_rtype ( rtype , buf ) ; } } return Ok ( ( ) ) ; } else if self . ctype . is_mset ( ) { buf . extend_from_slice ( BYTES_LEN3_HEAD ) ; if let RespType :: Array ( _ , arrs ) = & self . req . rtype { for rtype in arrs { self . req . save_by_rtype ( rtype , buf ) ; } } return Ok ( ( ) ) ; } else if self . ctype . is_mget ( ) { buf . extend_from_slice ( BYTES_LEN2_HEAD ) ; buf . extend_from_slice ( BYTES_GET ) ; if let RespType :: Array ( _ , arrs ) = & self . req . rtype { for rtype in & arrs [ 1 .. ] { self . req . save_by_rtype ( rtype , buf ) ; } } return Ok ( ( ) ) ; } self . req . save ( buf ) ; Ok ( ( ) ) }
save redis Command into given BytesMut
save redis Command into given BytesMut
&self
buf
&mut BytesMut