Skip to content

Commit e00c496

Browse files
authored
doc: fix TcpListener example to compile (#1911)
The `process_socket` is hidden from the user which makes the example fail to compile if copied by the reader.
1 parent 9c9fabc commit e00c496

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tokio/src/net/tcp/listener.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ cfg_tcp! {
1818
/// use tokio::net::TcpListener;
1919
///
2020
/// use std::io;
21-
/// # async fn process_socket<T>(_socket: T) {}
21+
///
22+
/// async fn process_socket<T>(socket: T) {
23+
/// # drop(socket);
24+
/// // do work with socket here
25+
/// }
2226
///
2327
/// #[tokio::main]
2428
/// async fn main() -> io::Result<()> {

0 commit comments

Comments
 (0)