mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-28 00:00:11 +02:00
io: use vec in example for AsyncReadExt::read_exact (#5863)
This commit is contained in:
@@ -292,7 +292,8 @@ cfg_io_util! {
|
|||||||
/// #[tokio::main]
|
/// #[tokio::main]
|
||||||
/// async fn main() -> io::Result<()> {
|
/// async fn main() -> io::Result<()> {
|
||||||
/// let mut f = File::open("foo.txt").await?;
|
/// let mut f = File::open("foo.txt").await?;
|
||||||
/// let mut buffer = [0; 10];
|
/// let len = 10;
|
||||||
|
/// let mut buffer = vec![0; len];
|
||||||
///
|
///
|
||||||
/// // read exactly 10 bytes
|
/// // read exactly 10 bytes
|
||||||
/// f.read_exact(&mut buffer).await?;
|
/// f.read_exact(&mut buffer).await?;
|
||||||
|
|||||||
Reference in New Issue
Block a user