doc: make TcpListener example more simple

This commit is contained in:
Tshepang Lekhonkhobe 2016-08-30 06:42:56 +02:00
parent 86dde9bbda
commit c36ccf7912

View File

@ -45,7 +45,6 @@ pub struct TcpStream(net_imp::TcpStream);
///
/// ```no_run
/// use std::net::{TcpListener, TcpStream};
/// use std::thread;
///
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
///
@ -57,17 +56,11 @@ pub struct TcpStream(net_imp::TcpStream);
/// for stream in listener.incoming() {
/// match stream {
/// Ok(stream) => {
/// thread::spawn(move|| {
/// // connection succeeded
/// handle_client(stream)
/// });
/// handle_client(stream);
/// }
/// Err(e) => { /* connection failed */ }
/// }
/// }
///
/// // close the socket server
/// drop(listener);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub struct TcpListener(net_imp::TcpListener);