← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 6075.c.1.k · 生成模型:未记录

工作区统一构建协作

理解等级:中级

Cargo 工作区管理一起开发的多个包。顶层清单通过 [workspace] 声明成员。工作区共享锁文件和产物目录,互相依赖的成员可复用构建结果。成员关系用于统一管理,包之间的依赖仍需显式声明。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 深入 Cargo 与 Crates.io Cargo Workspaces · 查看原书依据

      The workspace has one target directory at the top level that the compiled artifacts will be placed into; the adder package doesn’t have its own target directory. Even if we were to run cargo build from inside the adder directory, the compiled artifacts would still end up in add/target rather than add/adder/target.

    参考来源

    - 位置:《The Rust Programming Language(第2版)》第14章 深入 Cargo 与 Crates.io(来源项目 a19c7933-4eda-4176-aebd-30fe7e1ad292,`extracted/The Rust Programming Language(第2版)/_epub-src/c14.xhtml`,块 0137) - 结论依据:原文用共享 target 解释跨成员构建产物可以复用。 - 原始内容:The workspace has one target directory at the top level that the compiled artifacts will be placed into; the adder package doesn’t have its own target directory. Even if we were to run cargo build from inside the adder directory, the compiled artifacts would still end up in add/target rather than add/adder/target.