copyedits: patterns

This also puts slice patterns in nightly docs, where they belong.
This commit is contained in:
Steve Klabnik 2015-04-10 12:19:26 -04:00
parent 9aa4b643c4
commit b577beeb3a
3 changed files with 66 additions and 51 deletions

View 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),
_ => {},
}
}
```