我有多工作空间 Cargo 项目。它有两个工作区,common
and server
. common
is a lib
项目和服务器是bin
项目。
该项目在Github中的位置是here. https://github.com/rajcspsg/multi_module_cargo_project
下面是项目结构。
.
├── Cargo.toml
├── common
│ ├── Cargo.toml
│ └── src
│ └── lib.rs
├── README.md
└── server
├── Cargo.toml
└── src
└── main.rs
4 directories, 6 files
./Cargo.toml 文件的文件内容是
[package]
name = "multi_module_cargo_project"
version = "0.1.0"
authors = ["rajkumar"]
[workspace]
members = ["common", "server"]
[dependencies]
当我运行命令时cargo build --all
:
error: failed to parse manifest at `/home/rajkumar/Coding/Rust/ProgrammingRust/multi_module_cargo_project/Cargo.toml`
Caused by:
no targets specified in the manifest
either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present
所以我在下面添加了Cargo.toml
但仍然无法构建该项目。
[[bin]]
name = "server/src/main.rs"
我怎样才能构建该项目。我缺少什么?