Remove actix_rt direct usage.

This commit is contained in:
Luca Palmieri 2021-12-26 15:41:40 +01:00
parent 28d438b478
commit f80816aad6
4 changed files with 16 additions and 3 deletions

13
Cargo.lock generated
View file

@ -1415,13 +1415,26 @@ dependencies = [
"libc", "libc",
"memchr", "memchr",
"mio 0.7.13", "mio 0.7.13",
"num_cpus",
"once_cell", "once_cell",
"parking_lot", "parking_lot",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry", "signal-hook-registry",
"tokio-macros",
"winapi", "winapi",
] ]
[[package]]
name = "tokio-macros"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "tokio-native-tls" name = "tokio-native-tls"
version = "0.3.0" version = "0.3.0"

View file

@ -14,7 +14,7 @@ name = "zero2prod"
[dependencies] [dependencies]
actix-web = "=4.0.0-beta.15" actix-web = "=4.0.0-beta.15"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
[dev-dependencies] [dev-dependencies]
reqwest = "0.11" reqwest = "0.11"
tokio = "1"

View file

@ -1,7 +1,7 @@
use std::net::TcpListener; use std::net::TcpListener;
use zero2prod::run; use zero2prod::run;
#[actix_web::main] #[tokio::main]
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
let address = TcpListener::bind("127.0.0.1:8000")?; let address = TcpListener::bind("127.0.0.1:8000")?;
run(address)?.await run(address)?.await

View file

@ -11,7 +11,7 @@ fn spawn_app() -> String {
format!("http://127.0.0.1:{}", port) format!("http://127.0.0.1:{}", port)
} }
#[actix_web::test] #[tokio::test]
async fn health_check_works() { async fn health_check_works() {
// Arrange // Arrange
let address = spawn_app(); let address = spawn_app();