/// Receives data on the socket from the remote address to which it is
/// connected, without removing that data from the queue. On success,
/// returns the number of bytes peeked.
///
/// Successive calls return the same data. This is accomplished by passing
/// `MSG_PEEK` as a flag to the underlying recv system call.
Receives data on the socket from the remote address to which it is
connected, without removing that data from the queue. On success,
returns the number of bytes peeked.

Successive calls return the same data. This is accomplished by passing
`MSG_PEEK` as a flag to the underlying recv system call.
Receives data on the socket from the remote address to which it is connected without removing that data from the queue . On success returns the number of bytes peeked . Successive calls return the same data . This is accomplished by passing ` MSG_PEEK ` as a flag to the underlying recv system call .
pub fn peek(&mut self, buf: &mut [u8]) -> io::Result<usize> {
        if let Async::NotReady = self.io.poll_read() {
            return Err(io::ErrorKind::WouldBlock.into())
        }
        match self.io.get_ref().peek(buf) {
            Ok(v) => Ok(v),
            Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
                self.io.need_read()?;
                Err(io::ErrorKind::WouldBlock.into())
            }
            Err(e) => Err(e),
        }
    }
pub fn peek ( & mut self , buf : & mut [ u8 ] ) -> io :: Result < usize > { if let Async :: NotReady = self . io . poll_read ( ) { return Err ( io :: ErrorKind :: WouldBlock . into ( ) ) } match self . io . get_ref ( ) . peek ( buf ) { Ok ( v ) => Ok ( v ) , Err ( ref e ) if e . kind ( ) == io :: ErrorKind :: WouldBlock => { self . io . need_read ( ) ? ; Err ( io :: ErrorKind :: WouldBlock . into ( ) ) } Err ( e ) => Err ( e ) , } }
Receives data on the socket from the remote address to which it is
connected, without removing that data from the queue.
Receives data on the socket from the remote address to which it is connected without removing that data from the queue .
&mut self
buf
&mut [u8]