Skip to content

Commit d9ed1fd

Browse files
committed
ci: generate pages at 8bc7420 [ci skip]
1 parent 8bc7420 commit d9ed1fd

File tree

4 files changed

+54
-8
lines changed

4 files changed

+54
-8
lines changed

docs/flow_control/if_let.html

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,12 @@ <h1 id="if-let"><a class="header" href="#if-let">if let</a></h1>
222222
println!(&quot;I don't like letters. Let's go with an emoticon :)!&quot;);
223223
}
224224
}</code></pre></pre>
225-
<p>In the same way, <code>if let</code> can be used to match any enum value:</p>
225+
<!--
226+
In the same way, `if let` can be used to match any enum value:
227+
-->
228+
<p>同じように、<code>if let</code>を列挙型の値にマッチさせるのに利用できます。</p>
226229
<pre><pre class="playground"><code class="language-rust editable edition2021">// Our example enum
230+
// 列挙型の例
227231
enum Foo {
228232
Bar,
229233
Baz,
@@ -232,44 +236,63 @@ <h1 id="if-let"><a class="header" href="#if-let">if let</a></h1>
232236

233237
fn main() {
234238
// Create example variables
239+
// 変数の例を作成する
235240
let a = Foo::Bar;
236241
let b = Foo::Baz;
237242
let c = Foo::Qux(100);
238243

239244
// Variable a matches Foo::Bar
245+
// 変数aはFoo::Barにマッチする
240246
if let Foo::Bar = a {
241247
println!(&quot;a is foobar&quot;);
242248
}
243249

244250
// Variable b does not match Foo::Bar
245251
// So this will print nothing
252+
// 変数bはFoo::Barにマッチしないので、これは何も出力しない
246253
if let Foo::Bar = b {
247254
println!(&quot;b is foobar&quot;);
248255
}
249256

250257
// Variable c matches Foo::Qux which has a value
251258
// Similar to Some() in the previous example
259+
// 変数cはFoo::Quxにマッチし、値を持つ
260+
// 以前のSome()の例と同様
252261
if let Foo::Qux(value) = c {
253262
println!(&quot;c is {}&quot;, value);
254263
}
255264

256265
// Binding also works with `if let`
266+
// `if let`でも束縛は動作する
257267
if let Foo::Qux(value @ 100) = c {
258268
println!(&quot;c is one hundred&quot;);
259269
}
260270
}</code></pre></pre>
261-
<p>Another benefit is that <code>if let</code> allows us to match non-parameterized enum variants. This is true even in cases where the enum doesn't implement or derive <code>PartialEq</code>. In such cases <code>if Foo::Bar == a</code> would fail to compile, because instances of the enum cannot be equated, however <code>if let</code> will continue to work.</p>
262-
<p>Would you like a challenge? Fix the following example to use <code>if let</code>:</p>
271+
<!--
272+
Another benefit is that `if let` allows us to match non-parameterized enum variants. This is true even in cases where the enum doesn't implement or derive `PartialEq`. In such cases `if Foo::Bar == a` would fail to compile, because instances of the enum cannot be equated, however `if let` will continue to work.
273+
-->
274+
<p><code>if let</code>を利用する別の利点は、パラメータ化されていない列挙型の値をマッチさせられることです。
275+
これは、列挙型が<code>PartialEq</code>を実装もderiveもしていない場合でも同様です。
276+
<code>PartialEq</code>がない場合には、<code>if Foo::Bar == a</code>はコンパイルできません。
277+
列挙型のインスタンスは比較できませんが、<code>if let</code>を使えば動作します。</p>
278+
<!--
279+
Would you like a challenge? Fix the following example to use `if let`:
280+
-->
281+
<p>次の例を<code>if let</code>を利用して修正するのにチャレンジしてみましょう。</p>
263282
<pre><pre class="playground"><code class="language-rust editable ignore mdbook-runnable edition2021">// This enum purposely neither implements nor derives PartialEq.
264283
// That is why comparing Foo::Bar == a fails below.
284+
// この列挙型はわざとPartialEqを実装もderiveもしていない
285+
// ゆえに以下でFoo::Bar == aの比較が失敗する
265286
enum Foo {Bar}
266287

267288
fn main() {
268289
let a = Foo::Bar;
269290

270291
// Variable a matches Foo::Bar
292+
// 変数aはFoo::Barにマッチする
271293
if Foo::Bar == a {
272294
// ^-- this causes a compile-time error. Use `if let` instead.
295+
// ^-- これはコンパイル時エラー。代わりに`if let`を使う。
273296
println!(&quot;a is foobar&quot;);
274297
}
275298
}</code></pre></pre>

docs/print.html

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3655,8 +3655,12 @@ <h3 id="参照-19"><a class="header" href="#参照-19">参照</a></h3>
36553655
println!(&quot;I don't like letters. Let's go with an emoticon :)!&quot;);
36563656
}
36573657
}</code></pre></pre>
3658-
<p>In the same way, <code>if let</code> can be used to match any enum value:</p>
3658+
<!--
3659+
In the same way, `if let` can be used to match any enum value:
3660+
-->
3661+
<p>同じように、<code>if let</code>を列挙型の値にマッチさせるのに利用できます。</p>
36593662
<pre><pre class="playground"><code class="language-rust editable edition2021">// Our example enum
3663+
// 列挙型の例
36603664
enum Foo {
36613665
Bar,
36623666
Baz,
@@ -3665,44 +3669,63 @@ <h3 id="参照-19"><a class="header" href="#参照-19">参照</a></h3>
36653669

36663670
fn main() {
36673671
// Create example variables
3672+
// 変数の例を作成する
36683673
let a = Foo::Bar;
36693674
let b = Foo::Baz;
36703675
let c = Foo::Qux(100);
36713676

36723677
// Variable a matches Foo::Bar
3678+
// 変数aはFoo::Barにマッチする
36733679
if let Foo::Bar = a {
36743680
println!(&quot;a is foobar&quot;);
36753681
}
36763682

36773683
// Variable b does not match Foo::Bar
36783684
// So this will print nothing
3685+
// 変数bはFoo::Barにマッチしないので、これは何も出力しない
36793686
if let Foo::Bar = b {
36803687
println!(&quot;b is foobar&quot;);
36813688
}
36823689

36833690
// Variable c matches Foo::Qux which has a value
36843691
// Similar to Some() in the previous example
3692+
// 変数cはFoo::Quxにマッチし、値を持つ
3693+
// 以前のSome()の例と同様
36853694
if let Foo::Qux(value) = c {
36863695
println!(&quot;c is {}&quot;, value);
36873696
}
36883697

36893698
// Binding also works with `if let`
3699+
// `if let`でも束縛は動作する
36903700
if let Foo::Qux(value @ 100) = c {
36913701
println!(&quot;c is one hundred&quot;);
36923702
}
36933703
}</code></pre></pre>
3694-
<p>Another benefit is that <code>if let</code> allows us to match non-parameterized enum variants. This is true even in cases where the enum doesn't implement or derive <code>PartialEq</code>. In such cases <code>if Foo::Bar == a</code> would fail to compile, because instances of the enum cannot be equated, however <code>if let</code> will continue to work.</p>
3695-
<p>Would you like a challenge? Fix the following example to use <code>if let</code>:</p>
3704+
<!--
3705+
Another benefit is that `if let` allows us to match non-parameterized enum variants. This is true even in cases where the enum doesn't implement or derive `PartialEq`. In such cases `if Foo::Bar == a` would fail to compile, because instances of the enum cannot be equated, however `if let` will continue to work.
3706+
-->
3707+
<p><code>if let</code>を利用する別の利点は、パラメータ化されていない列挙型の値をマッチさせられることです。
3708+
これは、列挙型が<code>PartialEq</code>を実装もderiveもしていない場合でも同様です。
3709+
<code>PartialEq</code>がない場合には、<code>if Foo::Bar == a</code>はコンパイルできません。
3710+
列挙型のインスタンスは比較できませんが、<code>if let</code>を使えば動作します。</p>
3711+
<!--
3712+
Would you like a challenge? Fix the following example to use `if let`:
3713+
-->
3714+
<p>次の例を<code>if let</code>を利用して修正するのにチャレンジしてみましょう。</p>
36963715
<pre><pre class="playground"><code class="language-rust editable ignore mdbook-runnable edition2021">// This enum purposely neither implements nor derives PartialEq.
36973716
// That is why comparing Foo::Bar == a fails below.
3717+
// この列挙型はわざとPartialEqを実装もderiveもしていない
3718+
// ゆえに以下でFoo::Bar == aの比較が失敗する
36983719
enum Foo {Bar}
36993720

37003721
fn main() {
37013722
let a = Foo::Bar;
37023723

37033724
// Variable a matches Foo::Bar
3725+
// 変数aはFoo::Barにマッチする
37043726
if Foo::Bar == a {
37053727
// ^-- this causes a compile-time error. Use `if let` instead.
3728+
// ^-- これはコンパイル時エラー。代わりに`if let`を使う。
37063729
println!(&quot;a is foobar&quot;);
37073730
}
37083731
}</code></pre></pre>

docs/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.

docs/searchindex.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)