mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +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
|
```rust
|
||||||
use tokio::net::TcpListener;
|
use tokio::net::TcpListener;
|
||||||
use tokio::prelude::*;
|
use tokio::prelude::*;
|
||||||
|
use std::net::SocketAddr;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let addr = "127.0.0.1:8080".parse()?;
|
let addr = "127.0.0.1:8080".parse::<SocketAddr>()?;
|
||||||
let mut listener = TcpListener::bind(&addr).unwrap();
|
let mut listener = TcpListener::bind(&addr).await?;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let (mut socket, _) = listener.accept().await?;
|
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
|
More examples can be found [here](tokio/examples). Note that the `master` branch
|
||||||
|
|||||||
Reference in New Issue
Block a user