Skip to content

Commit 0d3cbe2

Browse files
tesaguriseanmonstar
authored andcommitted
refactor(rt): remove re-export of tokio::main (#1879)
Closes #1878. BREAKING CHANGE: Replace all usage of `rt::main` with `tokio::main`.
1 parent 1d00bb2 commit 0d3cbe2

File tree

14 files changed

+14
-18
lines changed

14 files changed

+14
-18
lines changed

examples/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use hyper::Client;
1111
// A simple type alias so as to DRY.
1212
type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
1313

14-
#[hyper::rt::main]
14+
#[tokio::main]
1515
async fn main() -> Result<()> {
1616
pretty_env_logger::init();
1717

examples/client_json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use futures_util::TryStreamExt;
1212
// A simple type alias so as to DRY.
1313
type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
1414

15-
#[hyper::rt::main]
15+
#[tokio::main]
1616
async fn main() -> Result<()> {
1717
let url = "http://jsonplaceholder.typicode.com/users".parse().unwrap();
1818
let users = fetch_json(url).await?;

examples/hello.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ async fn hello(_: Request<Body>) -> Result<Response<Body>, hyper::Error> {
88
Ok(Response::new(Body::from("Hello World!")))
99
}
1010

11-
#[hyper::rt::main]
11+
#[tokio::main]
1212
pub async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
1313
pretty_env_logger::init();
1414

examples/multi_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async fn index2(_: Request<Body>) -> Result<Response<Body>, hyper::Error> {
1818
Ok(Response::new(Body::from(INDEX2)))
1919
}
2020

21-
#[hyper::rt::main]
21+
#[tokio::main]
2222
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
2323
pretty_env_logger::init();
2424

examples/params.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async fn param_example(req: Request<Body>) -> Result<Response<Body>, hyper::Erro
8080
}
8181
}
8282

83-
#[hyper::rt::main]
83+
#[tokio::main]
8484
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
8585
pretty_env_logger::init();
8686

examples/proxy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use hyper::{Client, Error, Server};
55
use hyper::service::{make_service_fn, service_fn};
66
use std::net::SocketAddr;
77

8-
#[hyper::rt::main]
8+
#[tokio::main]
99
async fn main() {
1010
pretty_env_logger::init();
1111

examples/send_file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ static INDEX: &str = "examples/send_file_index.html";
1111
static INTERNAL_SERVER_ERROR: &[u8] = b"Internal Server Error";
1212
static NOTFOUND: &[u8] = b"Not Found";
1313

14-
#[hyper::rt::main]
14+
#[tokio::main]
1515
async fn main() {
1616
pretty_env_logger::init();
1717

examples/single_threaded.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use tokio::runtime::current_thread;
1010

1111
// Configure a runtime that runs everything on the current thread,
1212
// which means it can spawn !Send futures...
13-
#[hyper::rt::main(single_thread)]
13+
#[tokio::main(single_thread)]
1414
async fn main() {
1515
pretty_env_logger::init();
1616

examples/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::sync::{Arc, atomic::{AtomicUsize, Ordering}};
66
use hyper::{Body, Error, Response, Server};
77
use hyper::service::{make_service_fn, service_fn};
88

9-
#[hyper::rt::main]
9+
#[tokio::main]
1010
async fn main() {
1111
pretty_env_logger::init();
1212

examples/upgrades.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ async fn client_upgrade_request(addr: SocketAddr) -> Result<()> {
109109
Ok(())
110110
}
111111

112-
#[hyper::rt::main]
112+
#[tokio::main]
113113
async fn main() {
114114
// For this example, we just make a server and our own client to talk to
115115
// it, so the exact port isn't important. Instead, let the OS give us an

0 commit comments

Comments
 (0)