// Uses the async/await mechanism for reading from the socket.
// Returns the requested size always.
Uses the async/await mechanism for reading from the socket.
Returns the requested size always.
Uses the async / await mechanism for reading from the socket . Returns the requested size always .
async fn read_using_await(&mut self, payload: &mut [u8]) -> usize {
        match self.reader.read_exact(payload).await {
            Ok(_) => {
                println!(
                    "read_await(): complete({}): read = {}",
                    payload[0],
                    payload.len(),
                );
                payload.len()
            }
            Err(e) => panic!("Failed to read: {:?}", e),
        }
    }
async fn read_using_await ( & mut self , payload : & mut [ u8 ] ) -> usize { match self . reader . read_exact ( payload ) . await { Ok ( _ ) => { println ! ( " " payload [ 0 ] payload len ( ) ) ; payload . len ( ) } Err ( e ) => panic ! ( " " e ) , } }
Uses the async/await mechanism for reading from the socket.
Uses the async / await mechanism for reading from the socket .
&mut self
payload
&mut [u8]