1 #![warn(rust_2018_idioms)] 2 #![cfg(feature = "full")] 3 4 use tokio::io::AsyncReadExt; 5 use tokio_test::assert_ok; 6 7 #[tokio::test] read_exact()8async fn read_exact() { 9 let mut buf = Box::new([0; 8]); 10 let mut rd: &[u8] = b"hello world"; 11 12 let n = assert_ok!(rd.read_exact(&mut buf[..]).await); 13 assert_eq!(n, 8); 14 assert_eq!(buf[..], b"hello wo"[..]); 15 } 16