summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2019-11-23 08:24:03 -0800
committerGitHub <noreply@github.com>2019-11-23 08:24:03 -0800
commit3ecaa6d91cef271b4c079a2e28bc3270280bcee6 (patch)
tree93c6eb135a0566e77c39e15120106b60b0565cae /examples
parent0bc68adb34fb981f213b81abac63d6375e513d48 (diff)
docs: improve tokio::io API documentation (#1815)
Adds method level documentation for `tokio::io`.
Diffstat (limited to 'examples')
-rw-r--r--examples/proxy.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/examples/proxy.rs b/examples/proxy.rs
index 4314d1b9..48f8f057 100644
--- a/examples/proxy.rs
+++ b/examples/proxy.rs
@@ -22,12 +22,13 @@
#![warn(rust_2018_idioms)]
-use futures::{future::try_join, FutureExt};
-use std::{env, error::Error};
-use tokio::{
- io::AsyncReadExt,
- net::{TcpListener, TcpStream},
-};
+use tokio::io;
+use tokio::net::{TcpListener, TcpStream};
+
+use futures::future::try_join;
+use futures::FutureExt;
+use std::env;
+use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
@@ -58,8 +59,8 @@ async fn transfer(mut inbound: TcpStream, proxy_addr: String) -> Result<(), Box<
let (mut ri, mut wi) = inbound.split();
let (mut ro, mut wo) = outbound.split();
- let client_to_server = ri.copy(&mut wo);
- let server_to_client = ro.copy(&mut wi);
+ let client_to_server = io::copy(&mut ri, &mut wo);
+ let server_to_client = io::copy(&mut ro, &mut wi);
try_join(client_to_server, server_to_client).await?;