知识卡片
成员依赖需要显式声明
若二进制需要调用相邻库,可在自身清单的 [dependencies] 中写 add_one = { path = "../add_one" }。members 表明哪些包并行开发,[dependencies] 表明具体哪个包使用另一个包。
相关卡片 [[工作区统一构建协作]]
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 深入 Cargo 与 Crates.io Cargo Workspaces · 查看原书依据
Cargo doesn’t assume that crates in a workspace will depend on each other, so we need to be explicit about the dependency relationships.
参考来源
- 位置:《The Rust Programming Language(第2版)》第14章 深入 Cargo 与 Crates.io(来源项目 a19c7933-4eda-4176-aebd-30fe7e1ad292,`extracted/The Rust Programming Language(第2版)/_epub-src/c14.xhtml`,块 0152)
- 结论依据:原文明确 Cargo 不会因为同属工作区就自动建立依赖。
- 原始内容:Cargo doesn’t assume that crates in a workspace will depend on each other, so we need to be explicit about the dependency relationships.