File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -4013,6 +4013,19 @@ match origin {
40134013}
40144014```
40154015
4016+ If you want to match against a slice or array, you can use ` [] ` :
4017+
4018+ ``` {rust}
4019+ fn main() {
4020+ let v = vec!["match_this", "1"];
4021+
4022+ match v.as_slice() {
4023+ ["match_this", second] => println!("The second element is {}", second),
4024+ _ => {},
4025+ }
4026+ }
4027+ ```
4028+
40164029Whew! That's a lot of different ways to match things, and they can all be
40174030mixed and matched, depending on what you're doing:
40184031
@@ -5271,7 +5284,7 @@ immediately.
52715284
52725285## Success and failure
52735286
5274- Tasks don't always succeed, they can also panic. A task that wishes to panic
5287+ Tasks don't always succeed, they can also panic. A task that wishes to panic
52755288can call the ` panic! ` macro, passing a message:
52765289
52775290``` {rust}
You can’t perform that action at this time.
0 commit comments