copyedits: patterns
This also puts slice patterns in nightly docs, where they belong.
This commit is contained in:
parent
9aa4b643c4
commit
b577beeb3a
3 changed files with 66 additions and 51 deletions
18
src/doc/trpl/slice-patterns.md
Normal file
18
src/doc/trpl/slice-patterns.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
% Slice patterns
|
||||
|
||||
If you want to match against a slice or array, you can use `&` with the
|
||||
`slice_patterns` feature:
|
||||
|
||||
```rust
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
let v = vec!["match_this", "1"];
|
||||
|
||||
match &v[..] {
|
||||
["match_this", second] => println!("The second element is {}", second),
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue