Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/libstd/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,23 @@ pub struct TcpStream(net_imp::TcpStream);
///
/// # Examples
///
/// ```no_run
/// ```
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB: I removed the no_run because now that the work is being done inside of process, which is never called, "running" this code doesn't really do much anyway.

/// # 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