知识卡片
定向运行工作区成员
在工作区根用 cargo test -p add_one 可定向测试一个成员,cargo run -p adder 选择要运行的包,cargo publish -p 包名 选择发布对象。成员仍有各自的包边界。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 深入 Cargo 与 Crates.io Depending on an External Package in a Workspace · 查看原书依据
We can also run tests for one particular crate in a workspace from the top-level directory by using the -p flag and specifying the name of the crate we want to test:
参考来源
- 位置:《The Rust Programming Language(第2版)》第14章 深入 Cargo 与 Crates.io(来源项目 a19c7933-4eda-4176-aebd-30fe7e1ad292,`extracted/The Rust Programming Language(第2版)/_epub-src/c14.xhtml`,块 0178)
- 结论依据:原文用 `-p` 在顶层只运行特定成员的测试。
- 原始内容:We can also run tests for one particular crate in a workspace from the top-level directory by using the -p flag and specifying the name of the crate we want to test: