@@ -195,7 +195,7 @@ <h1 class="title">パターン</h1>
195
195
<!-- We use them in [variable
196
196
bindings][bindings], [match statements][match], and other places, too.-->
197
197
198
- < p > パターンは < a href ="variable-bindings.html "> 変数束縛</ a > , < a href ="match.html "> マッチ文</ a > などで使われています。</ p >
198
+ < p > パターンは < a href ="variable-bindings.html "> 変数束縛</ a > 、 < a href ="match.html "> マッチ文</ a > などで使われています。</ p >
199
199
200
200
<!--Let’s go on a whirlwind tour of all of the things patterns can do!-->
201
201
@@ -231,7 +231,7 @@ <h1 class="title">パターン</h1>
231
231
232
232
<!-- There’s one pitfall with patterns: like anything that introduces a new binding,they introduce shadowing. For example: -->
233
233
234
- < p > パターンには一つ落とし穴があります。新しい束縛を導入すると、他の束縛を導入するものと同じように、シャドーイングします 。例えば:</ p >
234
+ < p > パターンには一つ落とし穴があります。新しい束縛を導入する他の構文と同様、パターンはシャドーイングをします 。例えば:</ p >
235
235
236
236
< span class ='rusttest '> fn main() {
237
237
let x = 'x';
@@ -254,7 +254,7 @@ <h1 class="title">パターン</h1>
254
254
255
255
<!-- This prints:-->
256
256
257
- < p > これの結果は以下のようになります: </ p >
257
+ < p > これは以下のように出力します。 </ p >
258
258
259
259
< pre > < code class ="language-text "> x: c c: c
260
260
x: x
@@ -264,14 +264,14 @@ <h1 class="title">パターン</h1>
264
264
`x` that’s in scope for the match arm. Because we already have a binding named
265
265
`x`, this new `x` shadows it. -->
266
266
267
- < p > 別の言い方をすると、 < code > x =></ code > はパターンへのマッチだけでなく 、マッチの腕内で有効な < code > x</ code > という名前の束縛を導入します。既に < code > x</ code > は束縛されていたので、この新しい < code > x</ code > はそれを覆い隠します 。</ p >
267
+ < p > 別の言い方をすると、 < code > x =></ code > は値をパターンにマッチさせ 、マッチの腕内で有効な < code > x</ code > という名前の束縛を導入します。既に < code > x</ code > という束縛が存在していたので、新たに導入した < code > x</ code > は、その古い < code > x </ code > をシャドーイングします 。</ p >
268
268
269
269
<!-- # Multiple patterns -->
270
270
271
271
< h1 id ='複式パターン ' class ='section-header '> < a href ='#複式パターン '> 複式パターン</ a > </ h1 >
272
272
<!-- You can match multiple patterns with `|`: -->
273
273
274
- < p > < code > |</ code > を使うと、複式パターンが導入できます :</ p >
274
+ < p > < code > |</ code > を使うと、複数のパターンにマッチさせることができます :</ p >
275
275
276
276
< span class ='rusttest '> fn main() {
277
277
let x = 1;
@@ -296,11 +296,11 @@ <h1 id='複式パターン' class='section-header'><a href='#複式パターン'
296
296
297
297
<!-- # Destructuring -->
298
298
299
- < h1 id ='デストラクチャリング ' class ='section-header '> < a href ='#デストラクチャリング ' > デストラクチャリング </ a > </ h1 >
299
+ < h1 id ='分配束縛 ' class ='section-header '> < a href ='#分配束縛 ' > 分配束縛 </ a > </ h1 >
300
300
<!-- If you have a compound data type, like a [`struct`][struct], you can destructure it
301
301
inside of a pattern: -->
302
302
303
- < p > 例えば < a href ="structs.html "> < code > struct</ code > </ a > のような複合データ型を作成したいとき、パターン内でデータを分解することができます 。</ p >
303
+ < p > < a href ="structs.html "> < code > struct</ code > </ a > のような複合データ型が存在するとき、パターン内でその値を分解することができます 。</ p >
304
304
305
305
< span class ='rusttest '> fn main() {
306
306
struct Point {
@@ -354,7 +354,7 @@ <h1 id='デストラクチャリング' class='section-header'><a href='#デス
354
354
355
355
<!-- If we only care about some of the values, we don’t have to give them all names: -->
356
356
357
- < p > 値の一部だけを扱いたい場合は、値の全てに名前を付ける必要はありません 。</ p >
357
+ < p > 値の一部にだけ興味がある場合は、値のすべてに名前を付ける必要はありません 。</ p >
358
358
359
359
< span class ='rusttest '> fn main() {
360
360
struct Point {
@@ -385,7 +385,7 @@ <h1 id='デストラクチャリング' class='section-header'><a href='#デス
385
385
386
386
<!-- You can do this kind of match on any member, not just the first:-->
387
387
388
- < p > どのメンバに対してもこの種のマッチを行うことができます。たとえ最初ではなくても: </ p >
388
+ < p > 最初のメンバだけでなく、 どのメンバに対してもこの種のマッチを行うことができます。</ p >
389
389
390
390
< span class ='rusttest '> fn main() {
391
391
struct Point {
@@ -417,7 +417,7 @@ <h1 id='デストラクチャリング' class='section-header'><a href='#デス
417
417
<!-- This ‘destructuring’ behavior works on any compound data type, like
418
418
[tuples][tuples] or [enums][enums]. -->
419
419
420
- < p > この「デストラクチャリング (destructuring)」 と呼ばれる振る舞いは、 < a href ="primitive-types.html#tuples "> タプル</ a > や < a href ="enums.html "> 列挙型</ a > のような、複合データ型で使用できます 。</ p >
420
+ < p > この「分配束縛」 (destructuring) と呼ばれる振る舞いは、 < a href ="primitive-types.html#tuples "> タプル</ a > や < a href ="enums.html "> 列挙型</ a > のような、任意の複合データ型で使用できます 。</ p >
421
421
422
422
<!-- # Ignoring bindings -->
423
423
@@ -428,7 +428,7 @@ <h1 id='束縛の無視' class='section-header'><a href='#束縛の無視'>束
428
428
429
429
<!-- For example, here’s a `match` against a `Result<T, E>`: -->
430
430
431
- < p > 例として、 < code > Result<T, E></ code > に対して < code > match</ code > を適用してみましょう :</ p >
431
+ < p > 例として、 < code > Result<T, E></ code > に対して < code > match</ code > をしてみましょう :</ p >
432
432
433
433
< span class ='rusttest '> fn main() {
434
434
let some_value: Result<i32, &'static str> = Err("There was an error");
@@ -446,12 +446,12 @@ <h1 id='束縛の無視' class='section-header'><a href='#束縛の無視'>束
446
446
in the `Err` arm, we use `_` to disregard the specific error, and just print
447
447
a general error message. -->
448
448
449
- < p > 最初の部分では < code > Ok</ code > ヴァリアント内の値を < code > value</ code > に結びつけています 。しかし < code > Err</ code > 部分では、特定のエラーを避けて、標準的なエラーメッセージを表示するために < code > _</ code > を使っています。</ p >
449
+ < p > 最初の部分では < code > Ok</ code > ヴァリアント内の値に < code > value</ code > を束縛しています 。しかし < code > Err</ code > 部分では、ヴァリアント内のエラー情報を無視して一般的なエラーメッセージを表示するために < code > _</ code > を使っています。</ p >
450
450
451
451
<!-- `_` is valid in any pattern that creates a binding. This can be useful to
452
452
ignore parts of a larger structure: -->
453
453
454
- < p > < code > _</ code > は束縛を伴うどんなパターンにおいても有効です。これは大きな構造の一部分を無視する際に有用です 。</ p >
454
+ < p > < code > _</ code > は束縛を導入するどのようなパターンにおいても有効です。これは大きな構造の一部を無視する際に有用です 。</ p >
455
455
456
456
< span class ='rusttest '> fn main() {
457
457
fn coordinate() -> (i32, i32, i32) {
@@ -471,7 +471,7 @@ <h1 id='束縛の無視' class='section-header'><a href='#束縛の無視'>束
471
471
<!-- Here, we bind the first and last element of the tuple to `x` and `z`, but
472
472
ignore the middle element. -->
473
473
474
- < p > ここでは、タプルの最初と最後の要素を < code > x</ code > と < code > z</ code > に結びつけています 。</ p >
474
+ < p > ここでは、タプルの最初と最後の要素に < code > x</ code > と < code > z</ code > を束縛します 。</ p >
475
475
476
476
<!-- Similarly, you can use `..` in a pattern to disregard multiple values. -->
477
477
@@ -511,7 +511,7 @@ <h1 id='束縛の無視' class='section-header'><a href='#束縛の無視'>束
511
511
< h1 id ='ref-と-ref-mut ' class ='section-header '> < a href ='#ref-と-ref-mut '> ref と ref mut</ a > </ h1 >
512
512
<!-- If you want to get a [reference][ref], use the `ref` keyword:-->
513
513
514
- < p > もし < a href ="references-and-borrowing.html "> リファレンス </ a > を取得したいときは < code > ref</ code > キーワードを使いましょう。</ p >
514
+ < p > < a href ="references-and-borrowing.html "> 参照 </ a > を取得したいときは < code > ref</ code > キーワードを使いましょう。</ p >
515
515
516
516
< span class ='rusttest '> fn main() {
517
517
let x = 5;
@@ -534,7 +534,7 @@ <h1 id='ref-と-ref-mut' class='section-header'><a href='#ref-と-ref-mut'>ref
534
534
keyword _creates_ a reference, for use in the pattern. If you need a mutable
535
535
reference, `ref mut` will work in the same way: -->
536
536
537
- < p > ここで < code > match</ code > 内の < code > r</ code > は < code > &i32</ code > 型を持っています。言い換えると < code > ref</ code > キーワードがリファレンスを < em > 作ります </ em > 。</ p >
537
+ < p > ここで < code > match</ code > 内の < code > r</ code > は < code > &i32</ code > 型を持っています。言い換えると、 < code > ref</ code > キーワードはパターン内で使う参照を < em > 作り出します </ em > 。ミュータブルな参照が必要な場合は、同様に < code > ref mut </ code > を使います 。</ p >
538
538
539
539
< span class ='rusttest '> fn main() {
540
540
let mut x = 5;
@@ -551,10 +551,10 @@ <h1 id='ref-と-ref-mut' class='section-header'><a href='#ref-と-ref-mut'>ref
551
551
552
552
<!-- # Ranges -->
553
553
554
- < h1 id ='レンジ ' class ='section-header '> < a href ='#レンジ ' > レンジ </ a > </ h1 >
554
+ < h1 id ='範囲 ' class ='section-header '> < a href ='#範囲 ' > 範囲 </ a > </ h1 >
555
555
<!-- You can match a range of values with `...`: -->
556
556
557
- < p > < code > ...</ code > で値のレンジのマッチを行うことができます :</ p >
557
+ < p > < code > ...</ code > で値の範囲をマッチさせることができます :</ p >
558
558
559
559
< span class ='rusttest '> fn main() {
560
560
let x = 1;
@@ -577,7 +577,7 @@ <h1 id='レンジ' class='section-header'><a href='#レンジ'>レンジ</a></h1
577
577
578
578
<!-- Ranges are mostly used with integers and `char`s: -->
579
579
580
- < p > レンジは大体 、整数か < code > char</ code > 型で使われます:</ p >
580
+ < p > 範囲は多くの場合 、整数か < code > char</ code > 型で使われます:</ p >
581
581
582
582
< span class ='rusttest '> fn main() {
583
583
let x = '💅';
@@ -605,7 +605,7 @@ <h1 id='レンジ' class='section-header'><a href='#レンジ'>レンジ</a></h1
605
605
< h1 id ='束縛 ' class ='section-header '> < a href ='#束縛 '> 束縛</ a > </ h1 >
606
606
<!-- You can bind values to names with `@`: -->
607
607
608
- < p > < code > @</ code > で値を名前と結びつけることができます 。</ p >
608
+ < p > < code > @</ code > で値に名前を束縛することができます 。</ p >
609
609
610
610
< span class ='rusttest '> fn main() {
611
611
let x = 1;
@@ -626,7 +626,7 @@ <h1 id='束縛' class='section-header'><a href='#束縛'>束縛</a></h1>
626
626
do a complicated match of part of a data structure: -->
627
627
628
628
< p > これは < code > got a range element 1</ code > を出力します。
629
- データ構造の一部に対する複雑なマッチが欲しいときに有用です :</ p >
629
+ データ構造の一部に対して複雑なマッチングをしたいときに有用です :</ p >
630
630
631
631
< span class ='rusttest '> fn main() {
632
632
#[derive(Debug)]
@@ -655,12 +655,12 @@ <h1 id='束縛' class='section-header'><a href='#束縛'>束縛</a></h1>
655
655
656
656
<!--This prints `Some("Steve")`: we’ve bound the inner `name` to `a`.-->
657
657
658
- < p > これは < code > Some("Steve")</ code > を出力します。内側の < code > name</ code > を < code > a</ code > に結びつけます 。</ p >
658
+ < p > これは < code > Some("Steve")</ code > を出力します。内側の < code > name</ code > の値への参照に < code > a</ code > を束縛します 。</ p >
659
659
660
660
<!-- If you use `@` with `|`, you need to make sure the name is bound in each part
661
661
of the pattern: -->
662
662
663
- < p > もし < code > | </ code > で < code > @ </ code > を使うときは、パターンのそれぞれの部分が名前と結びついているか確認する必要があります :</ p >
663
+ < p > < code > @ </ code > を < code > | </ code > と組み合わせて使う場合は、それぞれのパターンで同じ名前が束縛されるようにする必要があります :</ p >
664
664
665
665
< span class ='rusttest '> fn main() {
666
666
let x = 5;
@@ -717,7 +717,7 @@ <h1 id='ガード' class='section-header'><a href='#ガード'>ガード</a></h1
717
717
718
718
<!--If you’re using `if` with multiple patterns, the `if` applies to both sides:-->
719
719
720
- < p > 複式パターンで < code > if</ code > を使うと、 < code > if</ code > は両方に適用されます :</ p >
720
+ < p > 複式パターンで < code > if</ code > を使うと、 < code > if</ code > は < code > | </ code > の両側に適用されます :</ p >
721
721
722
722
< span class ='rusttest '> fn main() {
723
723
let x = 4;
@@ -739,7 +739,7 @@ <h1 id='ガード' class='section-header'><a href='#ガード'>ガード</a></h1
739
739
<!--This prints `no`, because the `if` applies to the whole of `4 | 5`, and not to
740
740
just the `5`. In other words, the precedence of `if` behaves like this: -->
741
741
742
- < p > これは < code > no</ code > を出力します。なぜなら < code > if</ code > は < code > 4 | 5</ code > 全体に適用されるのであって、 < code > 5</ code > 単独に対してではないからです 。つまり < code > if</ code > 節は以下のように振舞います:</ p >
742
+ < p > これは < code > no</ code > を出力します。なぜなら < code > if</ code > は < code > 4 | 5</ code > 全体に適用されるのであって、 < code > 5</ code > 単独に対して適用されるのではないからです 。つまり < code > if</ code > 節は以下のように振舞います:</ p >
743
743
744
744
< pre > < code class ="language-text "> (4 | 5) if y => ...
745
745
</ code > </ pre >
@@ -757,7 +757,7 @@ <h1 id='混ぜてマッチ' class='section-header'><a href='#混ぜてマッチ'
757
757
<!--Whew! That’s a lot of different ways to match things, and they can all be
758
758
mixed and matched, depending on what you’re doing: -->
759
759
760
- < p > ふう、マッチには様々な方法があるのですね。やりたいこと次第で 、それらを混ぜてマッチさせることもできます:</ p >
760
+ < p > ふう、マッチには様々な方法があるのですね。やりたいことに応じて 、それらを混ぜてマッチさせることもできます:</ p >
761
761
762
762
< span class ='rusttest '> fn main() {
763
763
match x {
0 commit comments