我正在尝试在 actix_web_lab 中使用 spa,但似乎存在导入错误

问题描述 投票:0回答:1
error[E0432]: unresolved import `actix_web_lab::web::spa`
  --> backend/src/main.rs:14:5
   |
14 | use actix_web_lab::web::spa;
   |     ^^^^^^^^^^^^^^^^^^^^^^^ no `spa` in `web`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `backend` (bin "backend") due to previous error

已经在目录中尝试过这个,但仍然不起作用

cargo add actix-web-lab
Or add the following line to your Cargo.toml:

actix-web-lab = "0.19.1"
rust single-page-application rust-cargo actix-web rust-actix
1个回答
1
投票

spa()
上的文档明确指出:

仅在 crate 功能

spa
上可用。

所以您需要启用此功能。例如。与

cargo add
:

cargo add actix-web-lab --features spa

或者通过更改 Cargo.toml:

actix-web-lab = { version = "0.19.1", features = ["spa"] }
© www.soinside.com 2019 - 2024. All rights reserved.