mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-20 00:00:08 +02:00
chore: fix compile error on latest nightly (#1512)
This commit is contained in:
@@ -57,11 +57,12 @@ A basic TCP echo server with Tokio:
|
||||
```rust
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::prelude::*;
|
||||
use std::net::SocketAddr;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let addr = "127.0.0.1:8080".parse()?;
|
||||
let mut listener = TcpListener::bind(&addr).unwrap();
|
||||
let addr = "127.0.0.1:8080".parse::<SocketAddr>()?;
|
||||
let mut listener = TcpListener::bind(&addr).await?;
|
||||
|
||||
loop {
|
||||
let (mut socket, _) = listener.accept().await?;
|
||||
@@ -90,6 +91,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
More examples can be found [here](tokio/examples). Note that the `master` branch
|
||||
|
||||
Reference in New Issue
Block a user