summaryrefslogtreecommitdiffstats
path: root/examples/chat.rs
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2020-10-08 12:12:56 -0700
committerGitHub <noreply@github.com>2020-10-08 12:12:56 -0700
commit066965cd59d01fd9d999152e32169a24dfe434fa (patch)
treeeef03ca071b8d9f285954a1f98fd85e3e188c98b /examples/chat.rs
parent6259893094ebcdfecb107fcf3682eaad1bd1903b (diff)
net: use &self with TcpListener::accept (#2919)
Uses the infrastructure added by #2828 to enable switching `TcpListener::accept` to use `&self`. This also switches `poll_accept` to use `&self`. While doing introduces a hazard, `poll_*` style functions are considered low-level. Most users will use the `async fn` variants which are more misuse-resistant. TcpListener::incoming() is temporarily removed as it has the same problem as `TcpSocket::by_ref()` and will be implemented later.
Diffstat (limited to 'examples/chat.rs')
-rw-r--r--examples/chat.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/chat.rs b/examples/chat.rs
index c4b8c6a2..3f945039 100644
--- a/examples/chat.rs
+++ b/examples/chat.rs
@@ -77,7 +77,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
// Bind a TCP listener to the socket address.
//
// Note that this is the Tokio TcpListener, which is fully async.
- let mut listener = TcpListener::bind(&addr).await?;
+ let listener = TcpListener::bind(&addr).await?;
tracing::info!("server running on {}", addr);