'System is not running' 对于 actix_rt 2.0.2

'System is not running' for actix_rt 2.0.2

我尝试更新到 actix_rt 2.0.2,但此后一直收到以下错误:

thread 'main' panicked at 'System is not running'

我的最小示例在这里

use actix_rt;
use actix_web::{HttpServer, App, HttpResponse};

async fn hello() -> HttpResponse {
    HttpResponse::Ok().finish()
}

#[actix_rt::main]
async fn main() -> std::io::Result<()> {
    let server = HttpServer::new(move || {
        App::new().route("/", actix_web::web::get().to(hello))
    });
    server.bind("127.0.0.1:8080")?.run().await
}

cargo.toml

[package]
name = "my_app"
version = "2.2.0"
authors = ["me"]
edition = "2018"

[dependencies]
actix = "0.10"
actix-web = { version = "3.3.2", default-features = false }
actix-rt = "2.0.2"

我假设它一定是actix crates之间的一些版本不兼容。是否有版本号的组合或我缺少的明显的东西才能让它们一起工作?

我需要 actix_rt 2.0.x 以便我可以与 Criterion

集成

提前感谢您的任何见解。

干杯!

您有不兼容的actix crate 版本。您可以将 actix-rt 降级到 1,或升级到测试版,例如:

actix = "0.11.0-beta.2"
actix-web = "4.0.0-beta.3"
actix-rt = "2.0.2"

#在您的 cargo.toml 文件中使用这些

    actix = "0.11.0"
    actix-web = "3.3.2"
    actix-rt = "1.1.1"
    serde = { version = "1.0.123", features = ["derive"] }