pub async fn next_response<R>(
        &mut self,
        req_msg: &RequestMessage<R>,
    ) -> Result<ResponseMessage<R::Response>, KfSocketError>
    where
        R: Request,
    {
        trace!("waiting for response");
        let next = self.0.next().await;
        if let Some(result) = next {
            match result {
                Ok(req_bytes) => {
                    let response = req_msg.decode_response(
                        &mut Cursor::new(&req_bytes),
                        req_msg.header.api_version(),
                    )?;
                    trace!("receive response: {:#?}", &response);
                    Ok(response)
                }
                Err(err) => {
                    error!("error receiving response: {:?}", err);
                    return Err(KfSocketError::IoError(err));
                }
            }
        } else {
            error!("no more response. server has terminated connection");
            Err(KfSocketError::IoError(IoError::new(
                ErrorKind::UnexpectedEof,
                "server has terminated connection",
            )))
        }
    }
/// as client, get next response from server
as client, get next response from server
as client get next response from server
pub async fn next_response<R>(
        &mut self,
        req_msg: &RequestMessage<R>,
    ) -> Result<ResponseMessage<R::Response>, KfSocketError>
    where
        R: Request,
    {
        trace!("waiting for response");
        let next = self.0.next().await;
        if let Some(result) = next {
            match result {
                Ok(req_bytes) => {
                    let response = req_msg.decode_response(
                        &mut Cursor::new(&req_bytes),
                        req_msg.header.api_version(),
                    )?;
                    trace!("receive response: {:#?}", &response);
                    Ok(response)
                }
                Err(err) => {
                    error!("error receiving response: {:?}", err);
                    return Err(KfSocketError::IoError(err));
                }
            }
        } else {
            error!("no more response. server has terminated connection");
            Err(KfSocketError::IoError(IoError::new(
                ErrorKind::UnexpectedEof,
                "server has terminated connection",
            )))
        }
    }
pub async fn next_response < R > ( & mut self , req_msg : & RequestMessage < R > , ) -> Result < ResponseMessage < R :: Response > , KfSocketError > where R : Request , { trace ! ( " " ) ; let next = self . 0 . next ( ) . await ; if let Some ( result ) = next { match result { Ok ( req_bytes ) => { let response = req_msg . decode_response ( & mut Cursor :: new ( & req_bytes ) , req_msg . header . api_version ( ) , ) ? ; trace ! ( " " response ) ; Ok ( response ) } Err ( err ) => { error ! ( " " err ) ; return Err ( KfSocketError :: IoError ( err ) ) ; } } } else { error ! ( " " ) ; Err ( KfSocketError :: IoError ( IoError :: new ( ErrorKind :: UnexpectedEof , " " , ) ) ) } }
as client, get next response from server
as client get next response from server
&mut self
req_msg
&RequestMessage<R>
&mut self
req_msg
&RequestMessage<R>