File tree 1 file changed +8
-9
lines changed
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -72,24 +72,23 @@ pub struct TcpStream(net_imp::TcpStream);
72
72
///
73
73
/// # Examples
74
74
///
75
- /// ```no_run
75
+ /// ```
76
+ /// # use std::io;
76
77
/// use std::net::{TcpListener, TcpStream};
77
78
///
78
- /// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
79
- ///
80
79
/// fn handle_client(stream: TcpStream) {
81
80
/// // ...
82
81
/// }
83
82
///
83
+ /// # fn process() -> io::Result<()> {
84
+ /// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
85
+ ///
84
86
/// // accept connections and process them serially
85
87
/// for stream in listener.incoming() {
86
- /// match stream {
87
- /// Ok(stream) => {
88
- /// handle_client(stream);
89
- /// }
90
- /// Err(e) => { /* connection failed */ }
91
- /// }
88
+ /// handle_client(stream?);
92
89
/// }
90
+ /// # Ok(())
91
+ /// # }
93
92
/// ```
94
93
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
95
94
pub struct TcpListener ( net_imp:: TcpListener ) ;
You can’t perform that action at this time.
0 commit comments