@@ -34767,15 +34767,15 @@ <h3 id="複数のパターン"><a class="header" href="#複数のパターン">
3476734767-->
3476834768<p>このコードは、<code>one or two</code>を出力します。</p>
3476934769<!--
34770- ### Matching Ranges of Values with `... `
34770+ ### Matching Ranges of Values with `..= `
3477134771-->
34772- <h3 id="で値の範囲に合致させる"><a class="header" href="#で値の範囲に合致させる"><code>... </code>で値の範囲に合致させる</a></h3>
34772+ <h3 id="で値の範囲に合致させる"><a class="header" href="#で値の範囲に合致させる"><code>..= </code>で値の範囲に合致させる</a></h3>
3477334773<!--
34774- The `... ` syntax allows us to match to an inclusive range of values. In the
34774+ The `..= ` syntax allows us to match to an inclusive range of values. In the
3477534775following code, when a pattern matches any of the values within the range, that
3477634776arm will execute:
3477734777-->
34778- <p><code>... </code>記法により、限度値を含む値の範囲にマッチさせることができます。以下のコードでは、
34778+ <p><code>..= </code>記法により、限度値を含む値の範囲にマッチさせることができます。以下のコードでは、
3477934779パターンが範囲内のどれかの値に合致すると、そのアームが実行されます:</p>
3478034780<pre><pre class="playground"><code class="language-rust">
3478134781<span class="boring">#![allow(unused)]
@@ -34784,21 +34784,21 @@ <h3 id="で値の範囲に合致させる"><a class="header" href="#で値の範
3478434784
3478534785match x {
3478634786 // 1から5まで
34787- 1 ... 5 => println!("one through five"),
34787+ 1..= 5 => println!("one through five"),
3478834788 // それ以外
3478934789 _ => println!("something else"),
3479034790}
3479134791<span class="boring">}
3479234792</span></code></pre></pre>
3479334793<!--
3479434794If `x` is 1, 2, 3, 4, or 5, the first arm will match. This syntax is more
34795- convenient than using the `|` operator to express the same idea; instead of `1
34796- ... 5`, we would have to specify `1 | 2 | 3 | 4 | 5` if we used `|`. Specifying
34795+ convenient than using the `|` operator to express the same idea; instead of `1..=5`,
34796+ we would have to specify `1 | 2 | 3 | 4 | 5` if we used `|`. Specifying
3479734797a range is much shorter, especially if we want to match, say, any number
3479834798between 1 and 1,000!
3479934799-->
3480034800<p><code>x</code>が1、2、3、4か5なら、最初のアームが合致します。この記法は、<code>|</code>演算子を使用して同じ考えを表現するより便利です;
34801- <code>1 ... 5</code>ではなく、<code>|</code>を使用したら、<code>1 | 2 | 3 | 4 | 5</code>と指定しなければならないでしょう。
34801+ <code>1..= 5</code>ではなく、<code>|</code>を使用したら、<code>1 | 2 | 3 | 4 | 5</code>と指定しなければならないでしょう。
3480234802範囲を指定する方が遥かに短いのです。特に1から1000までの値と合致させたいとかなら!</p>
3480334803<!--
3480434804Ranges are only allowed with numeric values or `char` values, because the
@@ -34818,9 +34818,9 @@ <h3 id="で値の範囲に合致させる"><a class="header" href="#で値の範
3481834818
3481934819match x {
3482034820 // ASCII文字前半
34821- 'a' ... 'j' => println!("early ASCII letter"),
34821+ 'a'..= 'j' => println!("early ASCII letter"),
3482234822 // ASCII文字後半
34823- 'k' ... 'z' => println!("late ASCII letter"),
34823+ 'k'..= 'z' => println!("late ASCII letter"),
3482434824 // それ以外
3482534825 _ => println!("something else"),
3482634826}
@@ -35885,13 +35885,13 @@ <h3 id="束縛"><a class="header" href="#束縛"><code>@</code>束縛</a></h3>
3588535885The *at* operator (`@`) lets us create a variable that holds a value at the
3588635886same time we’re testing that value to see whether it matches a pattern. Listing
358873588718-32 shows an example where we want to test that a `Message::Hello` `id` field
35888- is within the range `3... 7`. But we also want to bind the value to the variable
35888+ is within the range `3..= 7`. But we also want to bind the value to the variable
3588935889`id_variable` so we can use it in the code associated with the arm. We could
3589035890name this variable `id`, the same as the field, but for this example we’ll use
3589135891a different name.
3589235892-->
3589335893<p><em>at</em>演算子(<code>@</code>)により、値を保持する変数を生成するのと同時にその値がパターンに一致するかを調べることができます。
35894- リスト18-32は、<code>Message::Hello</code>の<code>id</code>フィールドが範囲<code>3... 7</code>にあるかを確かめたいという例です。
35894+ リスト18-32は、<code>Message::Hello</code>の<code>id</code>フィールドが範囲<code>3..= 7</code>にあるかを確かめたいという例です。
3589535895しかし、アームに紐づいたコードで使用できるように変数<code>id_variable</code>に値を束縛もしたいです。この変数をフィールドと同じ、
3589635896<code>id</code>と名付けることもできますが、この例では異なる名前にします。</p>
3589735897<pre><pre class="playground"><code class="language-rust">
@@ -35904,11 +35904,11 @@ <h3 id="束縛"><a class="header" href="#束縛"><code>@</code>束縛</a></h3>
3590435904let msg = Message::Hello { id: 5 };
3590535905
3590635906match msg {
35907- Message::Hello { id: id_variable @ 3... 7 } => {
35907+ Message::Hello { id: id_variable @ 3..= 7 } => {
3590835908 // 範囲内のidが見つかりました: {}
3590935909 println!("Found an id in range: {}", id_variable)
3591035910 },
35911- Message::Hello { id: 10... 12 } => {
35911+ Message::Hello { id: 10..= 12 } => {
3591235912 // 別の範囲内のidが見つかりました
3591335913 println!("Found an id in another range")
3591435914 },
@@ -35926,10 +35926,10 @@ <h3 id="束縛"><a class="header" href="#束縛"><code>@</code>束縛</a></h3>
3592635926<p><span class="caption"><code>@</code>を使用してテストしつつ、パターンの値に束縛する</span></p>
3592735927<!--
3592835928This example will print `Found an id in range: 5`. By specifying `id_variable
35929- @` before the range `3... 7`, we’re capturing whatever value matched the range
35929+ @` before the range `3..= 7`, we’re capturing whatever value matched the range
3593035930while also testing that the value matched the range pattern.
3593135931-->
35932- <p>この例は、<code>Found an id in range: 5</code>と出力します。範囲<code>3... 7</code>の前に<code>id_variable @</code>と指定することで、
35932+ <p>この例は、<code>Found an id in range: 5</code>と出力します。範囲<code>3..= 7</code>の前に<code>id_variable @</code>と指定することで、
3593335933値が範囲パターンに一致することを確認しつつ、範囲にマッチしたどんな値も捕捉しています。</p>
3593435934<!--
3593535935In the second arm, where we only have a range specified in the pattern, the code
0 commit comments