From 066965cd59d01fd9d999152e32169a24dfe434fa Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Thu, 8 Oct 2020 12:12:56 -0700 Subject: 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. --- tokio/src/task/spawn.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tokio/src/task') diff --git a/tokio/src/task/spawn.rs b/tokio/src/task/spawn.rs index 280e90ea..d7aca572 100644 --- a/tokio/src/task/spawn.rs +++ b/tokio/src/task/spawn.rs @@ -37,7 +37,7 @@ doc_rt_core! { /// /// #[tokio::main] /// async fn main() -> io::Result<()> { - /// let mut listener = TcpListener::bind("127.0.0.1:8080").await?; + /// let listener = TcpListener::bind("127.0.0.1:8080").await?; /// /// loop { /// let (socket, _) = listener.accept().await?; -- cgit v1.2.3