pub(crate) async fn peek(&self, b: &mut [u8]) -> Result<(usize, Attributes)> {
        let (n, a) = self.read(b).await?;

        // this might overwrite data if somebody peeked between the Read
        // and us getting the lock.  Oh well, we'll just drop a packet in
        // that case.
        let mut data = BytesMut::new();
        data.extend(b[..n].to_vec());
        {
            let mut internal = self.internal.lock().await;
            internal.peeked = Some(data.freeze());
            internal.peeked_attributes = Some(a.clone());
        }
        Ok((n, a))
    }
/// peek is like Read, but it doesn't discard the packet read
peek is like Read, but it doesn't discard the packet read
peek is like Read but it doesn ' t discard the packet read
pub(crate) async fn peek(&self, b: &mut [u8]) -> Result<(usize, Attributes)> {
        let (n, a) = self.read(b).await?;
        // this might overwrite data if somebody peeked between the Read
        // and us getting the lock.  Oh well, we'll just drop a packet in
        // that case.
        let mut data = BytesMut::new();
        data.extend(b[..n].to_vec());
        {
            let mut internal = self.internal.lock().await;
            internal.peeked = Some(data.freeze());
            internal.peeked_attributes = Some(a.clone());
        }
        Ok((n, a))
    }
pub ( crate ) async fn peek ( & self , b : & mut [ u8 ] ) -> Result < ( usize , Attributes ) > { let ( n , a ) = self . read ( b ) . await ? ; // this might overwrite data if somebody peeked between the Read // and us getting the lock.  Oh well, we'll just drop a packet in // that case. let mut data = BytesMut :: new ( ) ; data . extend ( b [ .. n ] . to_vec ( ) ) ; { let mut internal = self . internal . lock ( ) . await ; internal . peeked = Some ( data . freeze ( ) ) ; internal . peeked_attributes = Some ( a . clone ( ) ) ; } Ok ( ( n , a ) ) }
peek is like Read, but it doesn't discard the packet read
peek is like Read but it doesn ' t discard the packet read
&self
b
&mut [u8]