Skip to content

Commit 80d19fa

Browse files
committed
ci: generate pages at 6f0e270 [ci skip]
1 parent 6f0e270 commit 80d19fa

File tree

10 files changed

+106
-30
lines changed

10 files changed

+106
-30
lines changed

docs/attribute.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ <h1 id="アトリビュート"><a class="header" href="#アトリビュート">
188188
<li><code>#[attribute(key = &quot;value&quot;)]</code></li>
189189
<li><code>#[attribute(value)]</code></li>
190190
</ul>
191-
<p>Attributes can have multiple values and can be separated over multiple lines, too:</p>
191+
<!--
192+
Attributes can have multiple values and can be separated over multiple lines, too:
193+
-->
194+
<p>アトリビュートは複数の値を取ることができ、複数の行に分割することもできます。</p>
192195
<pre><code class="language-rust ignore">#[attribute(value, value2)]
193196

194197

docs/attribute/cfg.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,11 @@ <h1 id="cfg"><a class="header" href="#cfg"><code>cfg</code></a></h1>
165165
-->
166166
<p>前者は条件付きコンパイルを行いますが、後者は<code>true</code>または<code>false</code>リテラルに評価され実行時にチェックすることが可能です。
167167
いずれの場合も適切なシンタックスで記述する必要があります。</p>
168-
<p><code>cfg!</code>, unlike <code>#[cfg]</code>, does not remove any code and only evaluates to true or false. For example, all blocks in an if/else expression need to be valid when <code>cfg!</code> is used for the condition, regardless of what <code>cfg!</code> is evaluating.</p>
168+
<!--
169+
`cfg!`, unlike `#[cfg]`, does not remove any code and only evaluates to true or false. For example, all blocks in an if/else expression need to be valid when `cfg!` is used for the condition, regardless of what `cfg!` is evaluating.
170+
-->
171+
<p><code>#[cfg]</code>と異なり、<code>cfg!</code>はコードを削除せず、trueまたはfalseに評価されるだけです。
172+
例えば、<code>cfg!</code>が何を評価しているかに関係なく、<code>cfg!</code>が条件に利用されるとき、if/else式の中のすべてのブロックが有効でなくてはなりません。</p>
169173
<pre><pre class="playground"><code class="language-rust editable edition2021">// This function only gets compiled if the target OS is linux
170174
// この関数はターゲットOSがLinuxの時のみコンパイルされる。
171175
#[cfg(target_os = &quot;linux&quot;)]

docs/attribute/cfg/custom.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@ <h1 id="条件の追加"><a class="header" href="#条件の追加">条件の追
162162
fn main() {
163163
conditional_function();
164164
}</code></pre></pre>
165-
<p>Try to run this to see what happens without the custom <code>cfg</code> flag.</p>
165+
<!--
166+
Try to run this to see what happens without the custom `cfg` flag.
167+
-->
168+
<p>独自の<code>cfg</code>フラグを用いない場合、何が起きるかやってみてください。</p>
166169
<!--
167170
With the custom `cfg` flag:
168171
-->

docs/attribute/crate.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,13 @@ <h1 id="クレート"><a class="header" href="#クレート">クレート</a></h
155155
attribute can be used to set the name of the crate.
156156
-->
157157
<p><code>crate_type</code>アトリビュートは、そのクレートがライブラリ、バイナリのいずれにコンパイルされるべきかをコンパイラに伝えるために使用します。ライブラリの場合は、どのタイプのライブラリであるかも伝えることができます。<code>crate_name</code>はクレートの名前を決定するのに使用します。</p>
158-
<p>However, it is important to note that both the <code>crate_type</code> and <code>crate_name</code>
159-
attributes have <strong>no</strong> effect whatsoever when using Cargo, the Rust package
158+
<!--
159+
However, it is important to note that both the `crate_type` and `crate_name`
160+
attributes have **no** effect whatsoever when using Cargo, the Rust package
160161
manager. Since Cargo is used for the majority of Rust projects, this means
161-
real-world uses of <code>crate_type</code> and <code>crate_name</code> are relatively limited.</p>
162+
real-world uses of `crate_type` and `crate_name` are relatively limited.
163+
-->
164+
<p>しかし、<code>crate_type</code>アトリビュートも<code>crate_name</code>アトリビュートも、RustのパッケージマネージャCargoを利用している場合は<strong>何の</strong>影響もないと知っておくことは重要です。Cargoは大半のRustプロジェクトで利用されており、実世界での<code>crate_type</code><code>crate_name</code>の利用は比較的限られています。</p>
162165
<pre><pre class="playground"><code class="language-rust editable edition2021">// This crate is a library
163166
// このクレートはライブラリである。
164167
#![crate_type = &quot;lib&quot;]

docs/cargo/test.html

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,11 @@ <h1 id="テスト"><a class="header" href="#テスト">テスト</a></h1>
179179
-->
180180
<p><code>tests</code>内の各ファイルは個別の<a href="https://doc.rust-lang.org/book/ch11-03-test-organization.html#integration-tests">統合テスト</a>です。
181181
これはライブラリを依存クレートから呼ばれたかのようにテストできます。</p>
182-
<p>The <a href="../testing.html">Testing</a> chapter elaborates on the three different testing styles:
183-
<a href="../testing/unit_testing.html">Unit</a>, <a href="../testing/doc_testing.html">Doc</a>, and <a href="../testing/integration_testing.html">Integration</a>. </p>
182+
<!--
183+
The [Testing][testing] chapter elaborates on the three different testing styles:
184+
[Unit][unit_testing], [Doc][doc_testing], and [Integration][integration_testing].
185+
-->
186+
<p><a href="../testing.html">テスト</a>の章は3つの異なるテストスタイルについて解説しています:<a href="../testing/unit_testing.html">単体テスト</a><a href="../testing/doc_testing.html">ドキュメンテーションテスト</a>、そして<a href="../testing/integration_testing.html">結合テスト</a>です。</p>
184187
<!--
185188
`cargo` naturally provides an easy way to run all of your tests!
186189
-->
@@ -226,52 +229,65 @@ <h1 id="テスト"><a class="header" href="#テスト">テスト</a></h1>
226229
that they don't race with each other.
227230
-->
228231
<p>注意:Cargoは複数のテストを並列で実行することがありますので、それらが互いに競合しないようにしてください。</p>
229-
<p>One example of this concurrency causing issues is if two tests output to a
230-
file, such as below:</p>
232+
<!--
233+
One example of this concurrency causing issues is if two tests output to a
234+
file, such as below:
235+
-->
236+
<p>並行性が問題を引き起こす一例として、以下のように、2つのテストが1つのファイルに出力するケースがあります。</p>
231237
<pre><pre class="playground"><code class="language-rust edition2021"><span class="boring">#![allow(unused)]
232238
</span><span class="boring">fn main() {
233239
</span>#[cfg(test)]
234240
mod tests {
235241
// Import the necessary modules
242+
// 必要なモジュールをインポートする。
236243
use std::fs::OpenOptions;
237244
use std::io::Write;
238245

239246
// This test writes to a file
247+
// ファイルに書き込むテスト。
240248
#[test]
241249
fn test_file() {
242250
// Opens the file ferris.txt or creates one if it doesn't exist.
251+
// ferris.txtというファイルを開くか、存在しない場合は作成する。
243252
let mut file = OpenOptions::new()
244253
.append(true)
245254
.create(true)
246255
.open(&quot;ferris.txt&quot;)
247256
.expect(&quot;Failed to open ferris.txt&quot;);
248257

249258
// Print &quot;Ferris&quot; 5 times.
259+
// &quot;Ferris&quot;と5回書き込む。
250260
for _ in 0..5 {
251261
file.write_all(&quot;Ferris\n&quot;.as_bytes())
252262
.expect(&quot;Could not write to ferris.txt&quot;);
253263
}
254264
}
255265

256266
// This test tries to write to the same file
267+
// 同じファイルに書き込むテスト。
257268
#[test]
258269
fn test_file_also() {
259270
// Opens the file ferris.txt or creates one if it doesn't exist.
271+
// ferris.txtというファイルを開くか、存在しない場合は作成する。
260272
let mut file = OpenOptions::new()
261273
.append(true)
262274
.create(true)
263275
.open(&quot;ferris.txt&quot;)
264276
.expect(&quot;Failed to open ferris.txt&quot;);
265277

266278
// Print &quot;Corro&quot; 5 times.
279+
// &quot;Corro&quot;と5回書き込む。
267280
for _ in 0..5 {
268281
file.write_all(&quot;Corro\n&quot;.as_bytes())
269282
.expect(&quot;Could not write to ferris.txt&quot;);
270283
}
271284
}
272285
}
273286
<span class="boring">}</span></code></pre></pre>
274-
<p>Although the intent is to get the following:</p>
287+
<!--
288+
Although the intent is to get the following:
289+
-->
290+
<p>以下のような結果を得ようと意図しています。</p>
275291
<pre><code class="language-shell">$ cat ferris.txt
276292
Ferris
277293
Ferris
@@ -284,7 +300,10 @@ <h1 id="テスト"><a class="header" href="#テスト">テスト</a></h1>
284300
Corro
285301
Corro
286302
</code></pre>
287-
<p>What actually gets put into <code>ferris.txt</code> is this:</p>
303+
<!--
304+
What actually gets put into `ferris.txt` is this:
305+
-->
306+
<p>しかし、実際に<code>ferris.txt</code>に出力されるのは、以下の通りです。</p>
288307
<pre><code class="language-shell">$ cargo test test_foo
289308
Corro
290309
Ferris

docs/error/option_unwrap/map.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ <h1 id="combinators-map"><a class="header" href="#combinators-map">Combinators:
153153
manage control flow in a modular fashion.
154154
-->
155155
<p><code>match</code><code>Option</code>を扱うのに適したメソッドです。しかし、大量にこれを使用しているとじきに億劫になってくるでしょう。引数の値が有効である(訳注: この場合は<code>None</code>でない)必要がある関数を扱う際には特にそうです。
156-
In these cases, <a href="https://doc.rust-lang.org/reference/glossary.html#combinator">combinators</a> can be used to manage control flow in a modular fashion.</p>
156+
そうした場合には、<a href="https://doc.rust-lang.org/reference/glossary.html#combinator">コンビネータ</a>を使うと、処理の流れをモジュール化されたやり方で管理できます。</p>
157157
<!--
158158
`Option` has a built in method called `map()`, a combinator for the simple
159159
mapping of `Some -> Some` and `None -> None`. Multiple `map()` calls can be

docs/flow_control/match/binding.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ <h1 id="バインディング"><a class="header" href="#バインディング">
179179
n =&gt; println!(&quot;I'm an old person of age {:?}&quot;, n),
180180
}
181181
}</code></pre></pre>
182-
<p>You can also use binding to &quot;destructure&quot; <code>enum</code> variants, such as <code>Option</code>:</p>
182+
<!--
183+
You can also use binding to "destructure" `enum` variants, such as `Option`:
184+
-->
185+
<p><code>Option</code>のような、<code>enum</code>の値をデストラクトするためにも、バインディングを利用できます。</p>
183186
<pre><pre class="playground"><code class="language-rust editable edition2021">fn some_number() -&gt; Option&lt;u32&gt; {
184187
Some(42)
185188
}
@@ -188,10 +191,13 @@ <h1 id="バインディング"><a class="header" href="#バインディング">
188191
match some_number() {
189192
// Got `Some` variant, match if its value, bound to `n`,
190193
// is equal to 42.
194+
// `n`にバインドされた`Some`の値が42に等しいときにマッチ。
191195
Some(n @ 42) =&gt; println!(&quot;The Answer: {}!&quot;, n),
192196
// Match any other number.
197+
// それ以外の数値にマッチ。
193198
Some(n) =&gt; println!(&quot;Not interesting... {}&quot;, n),
194199
// Match anything else (`None` variant).
200+
// それ以外にマッチ(`None`の値)。
195201
_ =&gt; (),
196202
}
197203
}</code></pre></pre>

0 commit comments

Comments
 (0)