mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-27 00:00:12 +02:00
docs: improve tokio::io API documentation (#1815)
Adds method level documentation for `tokio::io`.
This commit is contained in:
@@ -41,7 +41,7 @@ async fn echo_server() {
|
||||
let (mut a, _) = assert_ok!(srv.accept().await);
|
||||
let (mut b, _) = assert_ok!(srv.accept().await);
|
||||
|
||||
let n = assert_ok!(a.copy(&mut b).await);
|
||||
let n = assert_ok!(io::copy(&mut a, &mut b).await);
|
||||
|
||||
let (expected, t2) = t.join().unwrap();
|
||||
let actual = t2.join().unwrap();
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![cfg(feature = "full")]
|
||||
|
||||
use tokio::io::{AsyncRead, AsyncReadExt};
|
||||
use tokio::io::{self, AsyncRead};
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
|
||||
@@ -31,7 +30,7 @@ async fn copy() {
|
||||
let mut rd = Rd(true);
|
||||
let mut wr = Vec::new();
|
||||
|
||||
let n = assert_ok!(rd.copy(&mut wr).await);
|
||||
let n = assert_ok!(io::copy(&mut rd, &mut wr).await);
|
||||
assert_eq!(n, 11);
|
||||
assert_eq!(wr, b"hello world");
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ async fn echo_server() {
|
||||
let (mut stream, _) = assert_ok!(srv.accept().await);
|
||||
let (mut rd, mut wr) = stream.split();
|
||||
|
||||
let n = assert_ok!(rd.copy(&mut wr).await);
|
||||
let n = assert_ok!(io::copy(&mut rd, &mut wr).await);
|
||||
assert_eq!(n, (ITER * msg.len()) as u64);
|
||||
|
||||
assert_ok!(rx.await);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![cfg(feature = "full")]
|
||||
|
||||
use tokio::io::AsyncWriteExt;
|
||||
use tokio::io::{self, AsyncWriteExt};
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
use tokio::prelude::*;
|
||||
use tokio_test::assert_ok;
|
||||
@@ -24,6 +24,6 @@ async fn shutdown() {
|
||||
let (mut stream, _) = assert_ok!(srv.accept().await);
|
||||
let (mut rd, mut wr) = stream.split();
|
||||
|
||||
let n = assert_ok!(rd.copy(&mut wr).await);
|
||||
let n = assert_ok!(io::copy(&mut rd, &mut wr).await);
|
||||
assert_eq!(n, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user