← 返回刚才阅读的位置

知识卡片

操作参考卡 · 6075.c.1.n · 生成模型:未记录

定向运行工作区成员

理解等级:初级

在工作区根用 cargo test -p add_one 可定向测试一个成员,cargo run -p adder 选择要运行的包,cargo publish -p 包名 选择发布对象。成员仍有各自的包边界。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《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: