pub fn recv(&mut self) -> anyhow::Result<(char, Message)> {
        let mut buf = [0; 1024];
        let until = Instant::now();
        loop {
            if until.elapsed() > self.timeout {
                bail!("timeout after {:?} waiting for new message", self.timeout);
            }
            let mut ch: char = '0';
            if self.recv_buf.len() > 0 {
                ch = self.recv_buf[0] as char;
            }
            if let Some(msg) = Message::parse(&mut self.recv_buf)? {
                return Ok((ch, msg));
            };
            // If there was no message, read more bytes.
            let sz = self.stream.read(&mut buf)?;
            self.recv_buf.extend_from_slice(&buf[..sz]);
        }
    }
/// Returns the PostgreSQL message format and the `Message`.
///
/// An error is returned if a new message is not received within the timeout.
Returns the PostgreSQL message format and the `Message`.
An error is returned if a new message is not received within the timeout.
Returns the PostgreSQL message format and the ` Message ` . An error is returned if a new message is not received within the timeout .
pub fn recv(&mut self) -> anyhow::Result<(char, Message)> {
        let mut buf = [0; 1024];
        let until = Instant::now();
        loop {
            if until.elapsed() > self.timeout {
                bail!("timeout after {:?} waiting for new message", self.timeout);
            }
            let mut ch: char = '0';
            if self.recv_buf.len() > 0 {
                ch = self.recv_buf[0] as char;
            }
            if let Some(msg) = Message::parse(&mut self.recv_buf)? {
                return Ok((ch, msg));
            };
            // If there was no message, read more bytes.
            let sz = self.stream.read(&mut buf)?;
            self.recv_buf.extend_from_slice(&buf[..sz]);
        }
    }
pub fn recv ( & mut self ) -> anyhow :: Result < ( char , Message ) > { let mut buf = [ 0 ; 1024 ] ; let until = Instant :: now ( ) ; loop { if until . elapsed ( ) > self . timeout { bail ! ( " " self timeout ) ; } let mut ch : char = '0' ; if self . recv_buf . len ( ) > 0 { ch = self . recv_buf [ 0 ] as char ; } if let Some ( msg ) = Message :: parse ( & mut self . recv_buf ) ? { return Ok ( ( ch , msg ) ) ; } ; // If there was no message, read more bytes. let sz = self . stream . read ( & mut buf ) ? ; self . recv_buf . extend_from_slice ( & buf [ .. sz ] ) ; } }
Returns the PostgreSQL message format and the `Message`.
Returns the PostgreSQL message format and the ` Message ` .
&mut self
&mut self