Skip to content

Commit 1090024

Browse files
committed
更新文档[bot]
1 parent 55f0b31 commit 1090024

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

last-commit.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f78ab89d7545ac17780e6a367055cc089f4cd2ec
1+
8c0eacd5c4acbb650497454f3a58c9e8083202a4

public/ch06-03-if-let.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ <h1 class="menu-title">The Rust Programming Language</h1>
249249

250250
<div id="content" class="content">
251251
<main>
252-
<h2 id="concise-control-flow-with-if-let-and-letelse" data-x-en="Concise Control Flow with if let and let...else"><a class="header" href="#concise-control-flow-with-if-let-and-letelse">使用 <code>if let</code><code>let...else</code> 实现简洁的控制流</a></h2>
252+
<h2 id="concise-control-flow-with-if-let-and-letelse"><a class="header" href="#concise-control-flow-with-if-let-and-letelse">使用 <code>if let</code><code>let...else</code> 实现简洁的控制流</a></h2>
253253
<p data-x-en="The if let syntax lets you combine if and let into a less verbose way to handle values that match one pattern while ignoring the rest. Consider the program in Listing 6-6 that matches on an Option<u8> value in the config_max variable but only wants to execute code if the value is the Some variant."><code>if let</code> 语法让你可以将 <code>if</code><code>let</code> 结合起来,以一种更简洁的方式处理匹配某个模式的值,同时忽略其他值。考虑列表 6-6 中的程序,该程序在 <code>config_max</code> 变量上匹配一个 <code>Option&lt;u8&gt;</code> 值,但只有当值是 <code>Some</code> 变体时才执行代码。</p>
254254
<figure class="listing" id="listing-6-6">
255255
<pre><pre class="playground"><code class="language-rust edition2024"><span class="boring">fn main() {

public/ch07-02-defining-modules-to-control-scope-and-privacy.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ <h3 id="grouping-related-code-in-modules"><a class="header" href="#grouping-rela
334334
</figure>
335335
<p data-x-en="We define a module with the mod keyword followed by the name of the module (in this case, front_of_house). The body of the module then goes inside curly brackets. Inside modules, we can place other modules, as in this case with the modules hosting and serving. Modules can also hold definitions for other items, such as structs, enums, constants, traits, and as in Listing 7-1, functions.">我们使用 <code>mod</code> 关键字后跟模块的名称(在本例中为 <code>front_of_house</code>)来定义一个模块。模块的主体内容则放在大括号内。在模块内部,我们可以放置其他模块,如本例中的 <code>hosting</code><code>serving</code> 模块。模块还可以包含其他项目的定义,例如结构体、枚举、常量、特征,以及如清单 7-1 所示的函数。</p>
336336
<p data-x-en="By using modules, we can group related definitions together and name why they’re related. Programmers using this code can navigate the code based on the groups rather than having to read through all the definitions, making it easier to find the definitions relevant to them. Programmers adding new functionality to this code would know where to place the code to keep the program organized.">通过使用模块,我们可以将相关的定义组合在一起,并命名它们为什么相关。使用此代码的程序员可以根据这些组来导航代码,而不需要阅读所有的定义,这使得更容易找到与他们相关的定义。向此代码添加新功能的程序员会知道将代码放置在哪里以保持程序的组织性。</p>
337-
<p data-x-en="Earlier, we mentioned that src/main.rs and src/lib.rs are called crate roots_. The reason for their name is that the contents of either of these two files form a module named crate at the root of the crate’s module structure, known as the module tree.">之前,我们提到 <em>src/main.rs</em><em>src/lib.rs</em> 被称为 <em>crate roots</em>。它们之所以被称为 crate roots,是因为这两个文件中的内容在 crate 的模块结构的根部形成一个名为 <code>crate</code> 的模块,这个模块结构被称为 <em>模块树</em></p>
337+
<p data-x-en="Earlier, we mentioned that src/main.rs and src/lib.rs are called crate roots. The reason for their name is that the contents of either of these two files form a module named crate at the root of the crate’s module structure, known as the module tree.">早些时候,我们提到 <em>src/main.rs</em><em>src/lib.rs</em> 被称为 crate 。它们之所以被称为 crate ,是因为这两个文件中的内容在 crate 的模块结构(称为 <em>模块树</em>)的根部形成一个名为 <code>crate</code> 的模块</p>
338338
<p data-x-en="Listing 7-2 shows the module tree for the structure in Listing 7-1.">列表 7-2 显示了列表 7-1 中结构的模块树。</p>
339339
<figure class="listing" id="listing-7-2">
340340
<pre><code class="language-text">crate

public/print.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6913,7 +6913,7 @@ <h3 id="grouping-related-code-in-modules"><a class="header" href="#grouping-rela
69136913
to find the definitions relevant to them. Programmers adding new functionality
69146914
to this code would know where to place the code to keep the program organized.</p>
69156915
<p>Earlier, we mentioned that <em>src/main.rs</em> and <em>src/lib.rs</em> are called <em>crate
6916-
roots</em>_. The reason for their name is that the contents of either of these two
6916+
roots</em>. The reason for their name is that the contents of either of these two
69176917
files form a module named <code>crate</code> at the root of the crate’s module structure,
69186918
known as the <em>module tree</em>.</p>
69196919
<p>Listing 7-2 shows the module tree for the structure in Listing 7-1.</p>

public/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)