Skip to content

Commit 5b96df0

Browse files
authored
Merge pull request #1027 from MarcusDunn/master
example for bindings after at
2 parents 4ac12f6 + 702bad4 commit 5b96df0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/patterns.md

+3
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,9 @@ match slice {
384384
// `end` is a slice of everything but the first element, which must be "a".
385385
["a", end @ ..] => println!("ends with: {:?}", end),
386386

387+
// 'whole' is the entire slice and `last` is the final element
388+
whole @ [.., last] => println!("the last element of {:?} is {}", whole, last),
389+
387390
rest => println!("{:?}", rest),
388391
}
389392

0 commit comments

Comments
 (0)