Skip to content

Commit

Permalink
Clean up TcpStream example
Browse files Browse the repository at this point in the history
Fixes #35950
  • Loading branch information
steveklabnik committed Apr 26, 2017
1 parent 15ce540 commit 7b7fe9b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/libstd/net/tcp.rs
Expand Up @@ -72,24 +72,23 @@ pub struct TcpStream(net_imp::TcpStream);
///
/// # Examples
///
/// ```no_run
/// ```
/// # use std::io;
/// use std::net::{TcpListener, TcpStream};
///
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
///
/// fn handle_client(stream: TcpStream) {
/// // ...
/// }
///
/// # fn process() -> io::Result<()> {
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
///
/// // accept connections and process them serially
/// for stream in listener.incoming() {
/// match stream {
/// Ok(stream) => {
/// handle_client(stream);
/// }
/// Err(e) => { /* connection failed */ }
/// }
/// handle_client(stream?);
/// }
/// # Ok(())
/// # }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub struct TcpListener(net_imp::TcpListener);
Expand Down

0 comments on commit 7b7fe9b

Please sign in to comment.