Skip to content

Commit 0d7abb4

Browse files
committed
Merge pull request #36 from dalance/slice-patterns
6.9. Slice Patterns
2 parents b5e03d9 + 234b2a8 commit 0d7abb4

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

1.6/ja/book/slice-patterns.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
% Slice patterns
1+
% スライスパターン
2+
<!-- % Slice patterns -->
23

3-
If you want to match against a slice or array, you can use `&` with the
4-
`slice_patterns` feature:
4+
<!-- If you want to match against a slice or array, you can use `&` with the -->
5+
<!-- `slice_patterns` feature: -->
6+
スライスや配列に対してマッチを行いたい場合、 `slice_patterns` フィーチャを有効にすると以下のように `&` を使うことができます。
57

68
```rust
79
#![feature(slice_patterns)]
@@ -16,10 +18,11 @@ fn main() {
1618
}
1719
```
1820

19-
The `advanced_slice_patterns` gate lets you use `..` to indicate any number of
20-
elements inside a pattern matching a slice. This wildcard can only be used once
21-
for a given array. If there's an identifier before the `..`, the result of the
22-
slice will be bound to that name. For example:
21+
<!-- The `advanced_slice_patterns` gate lets you use `..` to indicate any number of -->
22+
<!-- elements inside a pattern matching a slice. This wildcard can only be used once -->
23+
<!-- for a given array. If there's an identifier before the `..`, the result of the -->
24+
<!-- slice will be bound to that name. For example: -->
25+
`advanced_slice_patterns` フィーチャを有効にすると、スライスにマッチするパターンの中で `..` を使ってその要素の数が任意であることを示すことができます。このワイルドカードは与えるパターン配列の中で一度だけ使うことができます。もし `..` の前に識別子(訳注: 以下の例では `inside` )があれば、そのスライスの結果はその識別子名に束縛されます。例えば以下のようになります。
2326

2427
```rust
2528
#![feature(advanced_slice_patterns, slice_patterns)]

TranslationTable.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
| allocator | アロケータ
1515
| application | アプリケーション
1616
| arity | アリティ
17+
| array | 配列
1718
| associated - | 関連-
1819
| attribute | アトリビュート
1920
| binary | バイナリ
@@ -35,12 +36,14 @@
3536
| expression statement | 式文
3637
| feature | フィーチャ
3738
| generics | ジェネリクス
39+
| identifier | 識別子
3840
| immutable | イミュータブル
3941
| Intrinsics | Intrinsic
4042
| Lang Items | Lang Item
4143
| library | ライブラリ
4244
| lifetime | ライフタイム
4345
| link | リンク
46+
| match | マッチ
4447
| memory | メモリ
4548
| move | ムーブ
4649
| mutable | ミュータブル
@@ -59,3 +62,4 @@
5962
| trait | トレイト
6063
| unsized type | サイズ不定型
6164
| vector | vector
65+
| wildcard | ワイルドカード

0 commit comments

Comments
 (0)