File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 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);
7272///
7373/// # Examples
7474///
75- /// ```no_run
75+ /// ```
76+ /// # use std::io;
7677/// use std::net::{TcpListener, TcpStream};
7778///
78- /// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
79- ///
8079/// fn handle_client(stream: TcpStream) {
8180/// // ...
8281/// }
8382///
83+ /// # fn process() -> io::Result<()> {
84+ /// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
85+ ///
8486/// // accept connections and process them serially
8587/// 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?);
9289/// }
90+ /// # Ok(())
91+ /// # }
9392/// ```
9493#[ stable( feature = "rust1" , since = "1.0.0" ) ]
9594pub struct TcpListener ( net_imp:: TcpListener ) ;
You can’t perform that action at this time.
0 commit comments