4
4
< meta charset ="utf-8 ">
5
5
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
6
< meta name ="generator " content ="rustdoc ">
7
- < title > Slice patterns </ title >
7
+ < title > スライスパターン </ title >
8
8
9
9
< link rel ="stylesheet " type ="text/css " href ="rustbook.css ">
10
10
185
185
< div id ='page '>
186
186
187
187
188
- < h1 class ="title "> Slice patterns</ h1 >
189
- < p > If you want to match against a slice or array, you can use < code > &</ code > with the
190
- < code > slice_patterns</ code > feature:</ p >
188
+ < h1 class ="title "> スライスパターン</ h1 >
189
+ <!-- % Slice patterns -->
190
+
191
+ <!-- If you want to match against a slice or array, you can use `&` with the -->
192
+
193
+ <!-- `slice_patterns` feature: -->
194
+
195
+ < p > スライスや配列に対してマッチを行いたい場合、 < code > slice_patterns</ code > フィーチャを有効にすると以下のように < code > &</ code > を使うことができます。</ p >
191
196
< span class ='rusttest '> #![feature(slice_patterns)]
192
197
193
198
fn main() {
@@ -210,10 +215,15 @@ <h1 class="title">Slice patterns</h1>
210
215
}
211
216
}</ pre >
212
217
213
- < p > The < code > advanced_slice_patterns</ code > gate lets you use < code > ..</ code > to indicate any number of
214
- elements inside a pattern matching a slice. This wildcard can only be used once
215
- for a given array. If there's an identifier before the < code > ..</ code > , the result of the
216
- slice will be bound to that name. For example:</ p >
218
+ <!-- The `advanced_slice_patterns` gate lets you use `..` to indicate any number of -->
219
+
220
+ <!-- elements inside a pattern matching a slice. This wildcard can only be used once -->
221
+
222
+ <!-- for a given array. If there's an identifier before the `..`, the result of the -->
223
+
224
+ <!-- slice will be bound to that name. For example: -->
225
+
226
+ < p > < code > advanced_slice_patterns</ code > フィーチャを有効にすると、スライスにマッチするパターンの中で < code > ..</ code > を使ってその要素の数が任意であることを示すことができます。このワイルドカードは与えるパターン配列の中で一度だけ使うことができます。もし < code > ..</ code > の前に識別子(訳注: 以下の例では < code > inside</ code > )があれば、そのスライスの結果はその識別子名に束縛されます。例えば以下のようになります。</ p >
217
227
< span class ='rusttest '> #![feature(advanced_slice_patterns, slice_patterns)]
218
228
219
229
fn is_symmetric(list: &[u32]) -> bool {
0 commit comments