diff --git a/pages.zh/common/rustdoc.md b/pages.zh/common/rustdoc.md new file mode 100644 index 0000000000..f9b0045811 --- /dev/null +++ b/pages.zh/common/rustdoc.md @@ -0,0 +1,24 @@ +# rustdoc + +> 为 Rust 包(crate)生成文档。 +> 更多信息:。 + +- 从包(crate)的根文件生成文档: + +`rustdoc {{src/lib.rs}}` + +- 为项目传递一个名称: + +`rustdoc {{src/lib.rs}} --crate-name {{名称}}` + +- 从 Markdown 文件生成文档: + +`rustdoc {{路径/到/文件.md}}` + +- 指定输出目录: + +`rustdoc {{src/lib.rs}} {{[-o|--out-dir]}} {{路径/到/输出目录}}` + +- 显示帮助: + +`rustdoc {{[-h|--help]}}` diff --git a/pages.zh/common/rustfmt.md b/pages.zh/common/rustfmt.md index 85d61b6008..d2ebffb907 100644 --- a/pages.zh/common/rustfmt.md +++ b/pages.zh/common/rustfmt.md @@ -1,16 +1,24 @@ # rustfmt -> 格式化 Rust 源代码的工具。 +> 格式化 Rust 源代码。 > 更多信息:。 - 格式化文件,就地覆盖原始文件: `rustfmt {{路径/到/源文件.rs}}` -- 检查文件的格式并在控制台上显示所有更改: +- 检查文件的格式并在控制台显示所有变更: `rustfmt --check {{路径/到/源文件.rs}}` -- 格式化之前,备份所有修改过的文件(原始文件的扩展名为 `.bk`): +- 在格式化前备份所有修改的文件(原始文件会以 `.bk` 扩展名重命名): `rustfmt --backup {{路径/到/源文件.rs}}` + +- 使用特定的 Rust 风格版次(格式化规则)以详细模式格式化代码: + +`rustfmt --style-edition {{2015|2018|2021|2024}} {{[-v|--verbose]}} {{路径/到/源文件1.rs 路径/到/源文件2.rs ...}}` + +- 使用特定的 Rust 版次(语言特性和解析)格式化代码: + +`rustfmt --edition {{2015|2018|2021|2024}} {{路径/到/源文件1.rs 路径/到/源文件2.rs ...}}` diff --git a/pages.zh_TW/common/rustdoc.md b/pages.zh_TW/common/rustdoc.md new file mode 100644 index 0000000000..fbfb581d84 --- /dev/null +++ b/pages.zh_TW/common/rustdoc.md @@ -0,0 +1,24 @@ +# rustdoc + +> 為 Rust 套件(crate)產生文件。 +> 更多資訊:。 + +- 從套件(crate)的根檔案產生文件: + +`rustdoc {{src/lib.rs}}` + +- 為專案傳遞一個名稱: + +`rustdoc {{src/lib.rs}} --crate-name {{名稱}}` + +- 從 Markdown 檔案產生文件: + +`rustdoc {{路徑/到/檔案.md}}` + +- 指定輸出目錄: + +`rustdoc {{src/lib.rs}} {{[-o|--out-dir]}} {{路徑/到/輸出目錄}}` + +- 顯示說明: + +`rustdoc {{[-h|--help]}}` diff --git a/pages.zh_TW/common/rustfmt.md b/pages.zh_TW/common/rustfmt.md new file mode 100644 index 0000000000..f6a204d7a0 --- /dev/null +++ b/pages.zh_TW/common/rustfmt.md @@ -0,0 +1,24 @@ +# rustfmt + +> 格式化 Rust 原始碼。 +> 更多資訊:。 + +- 格式化檔案,就地覆蓋原始檔案: + +`rustfmt {{路徑/至/原始檔案.rs}}` + +- 檢查檔案的格式並在主控台顯示所有變更: + +`rustfmt --check {{路徑/至/原始檔案.rs}}` + +- 在格式化前備份所有修改的檔案(原始檔案會以 `.bk` 副檔名重命名): + +`rustfmt --backup {{路徑/至/原始檔案.rs}}` + +- 使用特定的 Rust 風格版次(格式化規則)以詳細模式格式化程式碼: + +`rustfmt --style-edition {{2015|2018|2021|2024}} {{[-v|--verbose]}} {{路徑/至/原始檔案1.rs 路徑/至/原始檔案2.rs ...}}` + +- 使用特定的 Rust 版次(語言特性和解析)格式化程式碼: + +`rustfmt --edition {{2015|2018|2021|2024}} {{路徑/至/原始檔案1.rs 路徑/至/原始檔案2.rs ...}}` diff --git a/pages/common/rustdoc.md b/pages/common/rustdoc.md index 9506eba547..2b44d75e25 100644 --- a/pages/common/rustdoc.md +++ b/pages/common/rustdoc.md @@ -17,4 +17,8 @@ - Specify the output directory: -`rustdoc {{src/lib.rs}} --out-dir {{path/to/output_directory}}` +`rustdoc {{src/lib.rs}} {{[-o|--out-dir]}} {{path/to/output_directory}}` + +- Display help: + +`rustdoc {{[-h|--help]}}`