<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>02-构建命令 on 编程那些事儿</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/</link><description>Recent content in 02-构建命令 on 编程那些事儿</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Tue, 11 Aug 2026 23:57:44 +0800</lastBuildDate><atom:link href="https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/index.xml" rel="self" type="application/rss+xml"/><item><title>01-cargo bench</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/01-cargo-bench/</link><pubDate>Thu, 30 Jul 2026 14:49:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/01-cargo-bench/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/cargo/"&gt;The Cargo Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="cargo-bench1"&gt;cargo-bench(1)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/cargo/commands/cargo-bench.html"&gt;https://doc.rust-lang.org/cargo/commands/cargo-bench.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="name"&gt;名称&lt;/h2&gt;
&lt;p&gt;cargo-bench &amp;mdash; 执行包的基准测试&lt;/p&gt;
&lt;h2 id="synopsis"&gt;大纲&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;cargo bench&lt;/code&gt; [&lt;em&gt;options&lt;/em&gt;] [&lt;em&gt;benchname&lt;/em&gt;] [&lt;code&gt;--&lt;/code&gt; &lt;em&gt;bench-options&lt;/em&gt;]&lt;/p&gt;
&lt;h2 id="description"&gt;描述&lt;/h2&gt;
&lt;p&gt;编译并执行基准测试。&lt;/p&gt;
&lt;p&gt;基准测试过滤参数 &lt;em&gt;benchname&lt;/em&gt; 以及两个短划线（&lt;code&gt;--&lt;/code&gt;）之后的所有参数都会传给基准测试二进制，进而传给 &lt;em&gt;libtest&lt;/em&gt;（rustc 内置的单元测试与微基准测试框架）。若同时向 Cargo 与二进制传参，则 &lt;code&gt;--&lt;/code&gt; 之后的参数传给二进制，之前的传给 Cargo。关于 libtest 参数的详情，请参见 &lt;code&gt;cargo bench -- --help&lt;/code&gt; 的输出，以及 rustc 手册中关于测试工作原理的章节：
&lt;a href="https://doc.rust-lang.org/rustc/tests/index.html"&gt;https://doc.rust-lang.org/rustc/tests/index.html&lt;/a&gt;。&lt;/p&gt;</description></item><item><title>02-cargo build</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/02-cargo-build/</link><pubDate>Thu, 30 Jul 2026 14:49:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/02-cargo-build/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/cargo/"&gt;The Cargo Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="cargo-build1"&gt;cargo-build(1)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/cargo/commands/cargo-build.html"&gt;https://doc.rust-lang.org/cargo/commands/cargo-build.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="name"&gt;名称&lt;/h2&gt;
&lt;p&gt;cargo-build &amp;mdash; 编译当前包&lt;/p&gt;
&lt;h2 id="synopsis"&gt;大纲&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;cargo build&lt;/code&gt; [&lt;em&gt;options&lt;/em&gt;]&lt;/p&gt;
&lt;h2 id="description"&gt;描述&lt;/h2&gt;
&lt;p&gt;编译本地包及其所有依赖。&lt;/p&gt;
&lt;h2 id="options"&gt;选项&lt;/h2&gt;
&lt;h3 id="package-selection"&gt;包选择&lt;/h3&gt;
&lt;p&gt;默认情况下，若未给出包选择选项，所选包取决于所选清单文件（若未给出 &lt;code&gt;--manifest-path&lt;/code&gt;，则基于当前工作目录）。若清单是工作空间根，则选择该工作空间的默认成员；否则仅选择清单所定义的包。&lt;/p&gt;</description></item><item><title>03-cargo check</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/03-cargo-check/</link><pubDate>Thu, 30 Jul 2026 14:49:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/03-cargo-check/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/cargo/"&gt;The Cargo Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="cargo-check1"&gt;cargo-check(1)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/cargo/commands/cargo-check.html"&gt;https://doc.rust-lang.org/cargo/commands/cargo-check.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="name"&gt;名称&lt;/h2&gt;
&lt;p&gt;cargo-check &amp;mdash; 检查当前包&lt;/p&gt;
&lt;h2 id="synopsis"&gt;大纲&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;cargo check&lt;/code&gt; [&lt;em&gt;options&lt;/em&gt;]&lt;/p&gt;
&lt;h2 id="description"&gt;描述&lt;/h2&gt;
&lt;p&gt;检查本地包及其所有依赖是否有错误。这实质上会编译这些包，但不执行最终的代码生成步骤，因此比运行 &lt;code&gt;cargo build&lt;/code&gt; 更快。编译器会将元数据文件保存到磁盘，以便在源文件未修改时后续运行可复用它们。某些诊断与错误仅在代码生成期间发出，因此本质上不会被 &lt;code&gt;cargo check&lt;/code&gt; 报告。&lt;/p&gt;</description></item><item><title>04-cargo clean</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/04-cargo-clean/</link><pubDate>Thu, 30 Jul 2026 14:49:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/04-cargo-clean/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/cargo/"&gt;The Cargo Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="cargo-clean1"&gt;cargo-clean(1)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/cargo/commands/cargo-clean.html"&gt;https://doc.rust-lang.org/cargo/commands/cargo-clean.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="name"&gt;名称&lt;/h2&gt;
&lt;p&gt;cargo-clean &amp;mdash; 移除已生成的产物&lt;/p&gt;
&lt;h2 id="synopsis"&gt;大纲&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;cargo clean&lt;/code&gt; [&lt;em&gt;options&lt;/em&gt;]&lt;/p&gt;
&lt;h2 id="description"&gt;描述&lt;/h2&gt;
&lt;p&gt;移除 target 目录中 Cargo 过去生成的产物。&lt;/p&gt;
&lt;p&gt;若不带任何选项，&lt;code&gt;cargo clean&lt;/code&gt; 将删除整个 target 目录。&lt;/p&gt;
&lt;h2 id="options"&gt;选项&lt;/h2&gt;
&lt;h3 id="package-selection"&gt;包选择&lt;/h3&gt;
&lt;p&gt;未选择任何包时，将清理工作空间中的所有包及其所有依赖。&lt;/p&gt;</description></item><item><title>05-cargo clippy</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/05-cargo-clippy/</link><pubDate>Thu, 30 Jul 2026 14:49:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/05-cargo-clippy/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/cargo/"&gt;The Cargo Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="cargo-clippy1"&gt;cargo-clippy(1)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/cargo/commands/cargo-clippy.html"&gt;https://doc.rust-lang.org/cargo/commands/cargo-clippy.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="name"&gt;名称&lt;/h2&gt;
&lt;p&gt;cargo-clippy &amp;mdash; 检查包以捕获常见错误并改进 Rust 代码&lt;/p&gt;
&lt;h2 id="description"&gt;描述&lt;/h2&gt;
&lt;p&gt;这是随 Rust 工具链分发的可选组件中的外部命令。
它并非内置于 Cargo，可能需要额外安装。&lt;/p&gt;</description></item><item><title>06-cargo doc</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/06-cargo-doc/</link><pubDate>Thu, 30 Jul 2026 14:49:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/06-cargo-doc/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/cargo/"&gt;The Cargo Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="cargo-doc1"&gt;cargo-doc(1)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/cargo/commands/cargo-doc.html"&gt;https://doc.rust-lang.org/cargo/commands/cargo-doc.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="name"&gt;名称&lt;/h2&gt;
&lt;p&gt;cargo-doc &amp;mdash; 构建包的文档&lt;/p&gt;
&lt;h2 id="synopsis"&gt;大纲&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;cargo doc&lt;/code&gt; [&lt;em&gt;options&lt;/em&gt;]&lt;/p&gt;
&lt;h2 id="description"&gt;描述&lt;/h2&gt;
&lt;p&gt;为本地包及所有依赖构建文档。输出以 rustdoc 的常规格式放在 &lt;code&gt;target/doc&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;注意：&lt;/strong&gt; 文档生成是累积的：target 目录中已有的文档文件在不同的 &lt;code&gt;cargo doc&lt;/code&gt; 调用之间会保留。若要移除已生成的文档，请对 &lt;a href="../04-cargo-clean/"&gt;cargo-clean(1)&lt;/a&gt; 传入 &lt;code&gt;--doc&lt;/code&gt;。&lt;/p&gt;</description></item><item><title>07-cargo fetch</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/07-cargo-fetch/</link><pubDate>Thu, 30 Jul 2026 14:49:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/07-cargo-fetch/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/cargo/"&gt;The Cargo Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="cargo-fetch1"&gt;cargo-fetch(1)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/cargo/commands/cargo-fetch.html"&gt;https://doc.rust-lang.org/cargo/commands/cargo-fetch.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="name"&gt;名称&lt;/h2&gt;
&lt;p&gt;cargo-fetch &amp;mdash; 从网络获取包的依赖&lt;/p&gt;
&lt;h2 id="synopsis"&gt;大纲&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;cargo fetch&lt;/code&gt; [&lt;em&gt;options&lt;/em&gt;]&lt;/p&gt;
&lt;h2 id="description"&gt;描述&lt;/h2&gt;
&lt;p&gt;若存在 &lt;code&gt;Cargo.lock&lt;/code&gt; 文件，此命令将确保所有 git 依赖和/或注册表依赖均已下载并可在本地使用。在 &lt;code&gt;cargo fetch&lt;/code&gt; 之后，除非锁文件发生变化，后续 Cargo 命令可离线运行。&lt;/p&gt;</description></item><item><title>08-cargo fix</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/08-cargo-fix/</link><pubDate>Thu, 30 Jul 2026 14:49:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/08-cargo-fix/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/cargo/"&gt;The Cargo Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="cargo-fix1"&gt;cargo-fix(1)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/cargo/commands/cargo-fix.html"&gt;https://doc.rust-lang.org/cargo/commands/cargo-fix.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="name"&gt;名称&lt;/h2&gt;
&lt;p&gt;cargo-fix &amp;mdash; 自动修复 rustc 报告的 lint 警告&lt;/p&gt;
&lt;h2 id="synopsis"&gt;大纲&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;cargo fix&lt;/code&gt; [&lt;em&gt;options&lt;/em&gt;]&lt;/p&gt;
&lt;h2 id="description"&gt;描述&lt;/h2&gt;
&lt;p&gt;此 Cargo 子命令会自动获取 rustc 诊断（如警告）中的建议，并将其应用到你的源代码。其目的是帮助自动化那些 rustc 本身已经知道如何告诉你去修复的任务！&lt;/p&gt;</description></item><item><title>09-cargo fmt</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/09-cargo-fmt/</link><pubDate>Thu, 30 Jul 2026 14:49:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/09-cargo-fmt/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/cargo/"&gt;The Cargo Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="cargo-fmt1"&gt;cargo-fmt(1)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/cargo/commands/cargo-fmt.html"&gt;https://doc.rust-lang.org/cargo/commands/cargo-fmt.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="name"&gt;名称&lt;/h2&gt;
&lt;p&gt;cargo-fmt &amp;mdash; 使用 rustfmt 格式化当前 crate 的所有 bin 与 lib 文件&lt;/p&gt;
&lt;h2 id="description"&gt;描述&lt;/h2&gt;
&lt;p&gt;这是随 Rust 工具链分发的可选组件中的外部命令。
它并非内置于 Cargo，可能需要额外安装。&lt;/p&gt;</description></item><item><title>10-cargo miri</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/10-cargo-miri/</link><pubDate>Thu, 30 Jul 2026 14:49:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/10-cargo-miri/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/cargo/"&gt;The Cargo Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="cargo-miri1"&gt;cargo-miri(1)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/cargo/commands/cargo-miri.html"&gt;https://doc.rust-lang.org/cargo/commands/cargo-miri.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="name"&gt;名称&lt;/h2&gt;
&lt;p&gt;cargo-miri &amp;mdash; 在 Miri 中运行二进制 crate 与测试&lt;/p&gt;
&lt;h2 id="description"&gt;描述&lt;/h2&gt;
&lt;p&gt;这是随 Rust 工具链分发的可选组件中的外部命令。
它并非内置于 Cargo，可能需要额外安装。&lt;/p&gt;
&lt;p&gt;此命令仅在 &lt;a href="https://doc.rust-lang.org/book/appendix-07-nightly-rust.html"&gt;nightly&lt;/a&gt; 通道可用。&lt;/p&gt;</description></item><item><title>11-cargo run</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/11-cargo-run/</link><pubDate>Thu, 30 Jul 2026 14:49:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/11-cargo-run/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/cargo/"&gt;The Cargo Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="cargo-run1"&gt;cargo-run(1)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/cargo/commands/cargo-run.html"&gt;https://doc.rust-lang.org/cargo/commands/cargo-run.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="name"&gt;名称&lt;/h2&gt;
&lt;p&gt;cargo-run &amp;mdash; 运行当前包&lt;/p&gt;
&lt;h2 id="synopsis"&gt;大纲&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;cargo run&lt;/code&gt; [&lt;em&gt;options&lt;/em&gt;] [&lt;code&gt;--&lt;/code&gt; &lt;em&gt;args&lt;/em&gt;]&lt;/p&gt;
&lt;h2 id="description"&gt;描述&lt;/h2&gt;
&lt;p&gt;运行本地包的二进制目标或示例。&lt;/p&gt;
&lt;p&gt;两个短划线（&lt;code&gt;--&lt;/code&gt;）之后的所有参数都会传给要运行的二进制程序。若同时向 Cargo 与二进制程序传参，则 &lt;code&gt;--&lt;/code&gt; 之后的参数传给二进制，之前的传给 Cargo。&lt;/p&gt;</description></item><item><title>12-cargo rustc</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/12-cargo-rustc/</link><pubDate>Thu, 30 Jul 2026 14:49:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/12-cargo-rustc/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/cargo/"&gt;The Cargo Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="cargo-rustc1"&gt;cargo-rustc(1)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/cargo/commands/cargo-rustc.html"&gt;https://doc.rust-lang.org/cargo/commands/cargo-rustc.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="name"&gt;名称&lt;/h2&gt;
&lt;p&gt;cargo-rustc &amp;mdash; 编译当前包，并向编译器传递额外选项&lt;/p&gt;
&lt;h2 id="synopsis"&gt;大纲&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;cargo rustc&lt;/code&gt; [&lt;em&gt;options&lt;/em&gt;] [&lt;code&gt;--&lt;/code&gt; &lt;em&gt;args&lt;/em&gt;]&lt;/p&gt;
&lt;h2 id="description"&gt;描述&lt;/h2&gt;
&lt;p&gt;将编译当前包（或由 &lt;code&gt;-p&lt;/code&gt; 指定的包）的指定目标及其所有依赖。指定的 &lt;em&gt;args&lt;/em&gt; 都会传给最终的编译器调用，而不会传给任何依赖。注意：编译器仍会无条件地收到诸如 &lt;code&gt;-L&lt;/code&gt;、&lt;code&gt;--extern&lt;/code&gt; 和 &lt;code&gt;--crate-type&lt;/code&gt; 等参数，指定的 &lt;em&gt;args&lt;/em&gt; 只是追加到编译器调用中。&lt;/p&gt;</description></item><item><title>13-cargo rustdoc</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/13-cargo-rustdoc/</link><pubDate>Thu, 30 Jul 2026 14:49:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/13-cargo-rustdoc/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/cargo/"&gt;The Cargo Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="cargo-rustdoc1"&gt;cargo-rustdoc(1)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/cargo/commands/cargo-rustdoc.html"&gt;https://doc.rust-lang.org/cargo/commands/cargo-rustdoc.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="name"&gt;名称&lt;/h2&gt;
&lt;p&gt;cargo-rustdoc &amp;mdash; 使用指定的自定义标志构建包的文档&lt;/p&gt;
&lt;h2 id="synopsis"&gt;大纲&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;cargo rustdoc&lt;/code&gt; [&lt;em&gt;options&lt;/em&gt;] [&lt;code&gt;--&lt;/code&gt; &lt;em&gt;args&lt;/em&gt;]&lt;/p&gt;
&lt;h2 id="description"&gt;描述&lt;/h2&gt;
&lt;p&gt;将为当前包（或由 &lt;code&gt;-p&lt;/code&gt; 指定的包）的指定目标生成文档，并把指定的 &lt;em&gt;args&lt;/em&gt; 传给最终的 rustdoc 调用。此命令不会为依赖生成文档。注意：rustdoc 仍会无条件地收到诸如 &lt;code&gt;-L&lt;/code&gt;、&lt;code&gt;--extern&lt;/code&gt; 和 &lt;code&gt;--crate-type&lt;/code&gt; 等参数，指定的 &lt;em&gt;args&lt;/em&gt; 只是追加到 rustdoc 调用中。&lt;/p&gt;</description></item><item><title>14-cargo test</title><link>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/14-cargo-test/</link><pubDate>Thu, 30 Jul 2026 14:49:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/cargo/cargo-commands/build-commands/14-cargo-test/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://doc.rust-lang.org/cargo/"&gt;The Cargo Book&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="cargo-test1"&gt;cargo-test(1)&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://doc.rust-lang.org/cargo/commands/cargo-test.html"&gt;https://doc.rust-lang.org/cargo/commands/cargo-test.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="name"&gt;名称&lt;/h2&gt;
&lt;p&gt;cargo-test &amp;mdash; 执行包的单元测试与集成测试&lt;/p&gt;
&lt;h2 id="synopsis"&gt;大纲&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;cargo test&lt;/code&gt; [&lt;em&gt;options&lt;/em&gt;] [&lt;em&gt;testname&lt;/em&gt;] [&lt;code&gt;--&lt;/code&gt; &lt;em&gt;test-options&lt;/em&gt;]&lt;/p&gt;
&lt;h2 id="description"&gt;描述&lt;/h2&gt;
&lt;p&gt;编译并执行单元测试、集成测试与文档测试。&lt;/p&gt;
&lt;p&gt;测试过滤参数 &lt;code&gt;TESTNAME&lt;/code&gt; 以及两个短划线（&lt;code&gt;--&lt;/code&gt;）之后的所有参数都会传给测试二进制，进而传给 &lt;em&gt;libtest&lt;/em&gt;（rustc 内置的单元测试与微基准测试框架）。若同时向 Cargo 与二进制传参，则 &lt;code&gt;--&lt;/code&gt; 之后的参数传给二进制，之前的传给 Cargo。关于 libtest 参数的详情，请参见 &lt;code&gt;cargo test -- --help&lt;/code&gt; 的输出，以及 rustc 手册中关于测试工作原理的章节：&lt;a href="https://doc.rust-lang.org/rustc/tests/index.html"&gt;https://doc.rust-lang.org/rustc/tests/index.html&lt;/a&gt;。&lt;/p&gt;</description></item></channel></rss>