diff --git a/examples/http-get.rs b/examples/http-get.rs index 51fa2e6..6fad942 100644 --- a/examples/http-get.rs +++ b/examples/http-get.rs @@ -6,6 +6,8 @@ //! $ nc localhost 8080 //! ``` +use std::net::TcpStream; + use futures::executor::block_on; use futures::io; use futures::prelude::*; @@ -13,7 +15,7 @@ use smol::Async; fn main() -> io::Result<()> { block_on(async { - let mut stream = Async::connect("www.example.com:80").await?; + let mut stream = Async::::connect("www.example.com:80").await?; stream .write_all(b"GET / HTTP/1.0\r\nHost: example.com\r\n\r\n") .await?; diff --git a/examples/tcp-echo.rs b/examples/tcp-echo.rs index ec3be5d..63c653d 100644 --- a/examples/tcp-echo.rs +++ b/examples/tcp-echo.rs @@ -6,7 +6,7 @@ //! $ nc localhost 8080 //! ``` -use std::net::TcpStream; +use std::net::{TcpListener, TcpStream}; use futures::executor::block_on; use futures::io; @@ -14,12 +14,13 @@ use smol::Async; async fn process(mut stream: Async) -> io::Result<()> { println!("Peer: {}", stream.source().peer_addr()?); - io::copy(stream.clone(), &mut stream).await + io::copy(stream.clone(), &mut stream).await?; + Ok(()) } fn main() -> io::Result<()> { block_on(async { - let listener = Async::bind("127.0.0.1:8080")?; + let listener = Async::::bind("127.0.0.1:8080")?; println!("Local: {}", listener.source().local_addr()?); loop {