From 457194bc626bb424bb2aa840fea2f204470e5755 Mon Sep 17 00:00:00 2001 From: Narukara Date: Fri, 16 Dec 2022 18:28:50 +0800 Subject: [PATCH 1/2] Update ch07-02-defining-modules-to-control-scope-and-privacy.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正奇怪的翻译 --- src/ch07-02-defining-modules-to-control-scope-and-privacy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch07-02-defining-modules-to-control-scope-and-privacy.md b/src/ch07-02-defining-modules-to-control-scope-and-privacy.md index e3b1fde..e15111c 100644 --- a/src/ch07-02-defining-modules-to-control-scope-and-privacy.md +++ b/src/ch07-02-defining-modules-to-control-scope-and-privacy.md @@ -10,7 +10,7 @@ ## 模块小抄 -这里我们提供一个简单的参考,用来解释模块、路径、`use`关键词和`pub`关键词如何在编译器中工作,和大部分开发者如何组织他们的代码。我们将在这个章节中对每条规则的例子一一列举,但这是一个用来参考的好地方用于表达模块是如何工作的。 +这里我们提供一个简单的参考,用来解释模块、路径、`use`关键词和`pub`关键词如何在编译器中工作,以及大部分开发者如何组织他们的代码。我们将在本章节中举例说明每条规则,不过这是一个解释模块工作方式的良好参考。 - **从crate根节点开始**: 当编译一个crate, 编译器首先在crate根文件(通常,对于一个库crate而言是*src/lib.rs*,对于一个二进制crate而言是*src/main.rs*)中寻找需要被编译的代码。 - **声明模块**: 在crate根文件中,你可以声明一个新模块;比如,你用`mod garden`声明了一个叫做`garden`的模块。编译器会在下列路径中寻找模块代码: From d40c8fa3881280c34fc084c6b8e80113fdc9570d Mon Sep 17 00:00:00 2001 From: Narukara Date: Sat, 17 Dec 2022 01:37:17 +0800 Subject: [PATCH 2/2] Update ch07-02-defining-modules-to-control-scope-and-privacy.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "Filename"改为"文件名" --- src/ch07-02-defining-modules-to-control-scope-and-privacy.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ch07-02-defining-modules-to-control-scope-and-privacy.md b/src/ch07-02-defining-modules-to-control-scope-and-privacy.md index e15111c..1fcfe6e 100644 --- a/src/ch07-02-defining-modules-to-control-scope-and-privacy.md +++ b/src/ch07-02-defining-modules-to-control-scope-and-privacy.md @@ -40,7 +40,7 @@ backyard 这个例子中的crate根文件是*src/main.rs*,该文件包括了: -Filename: src/main.rs +文件名: src/main.rs ```rust,noplayground,ignore {{#rustdoc_include ../listings/ch07-managing-growing-projects/quick-reference-example/src/main.rs}} @@ -48,7 +48,7 @@ backyard `pub mod garden;`行告诉编译器应该包含在*src/garden.rs*文件中发现的代码: -Filename: src/garden.rs +文件名: src/garden.rs ```rust,noplayground,ignore {{#rustdoc_include ../listings/ch07-managing-growing-projects/quick-reference-example/src/garden.rs}}