Skip to content

Commit

Permalink
Merge pull request #1027 from MarcusDunn/master
Browse files Browse the repository at this point in the history
example for bindings after at
  • Loading branch information
ehuss authored Jul 29, 2021
2 parents 4ac12f6 + 702bad4 commit 5b96df0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@ match slice {
// `end` is a slice of everything but the first element, which must be "a".
["a", end @ ..] => println!("ends with: {:?}", end),

// 'whole' is the entire slice and `last` is the final element
whole @ [.., last] => println!("the last element of {:?} is {}", whole, last),

rest => println!("{:?}", rest),
}

Expand Down

0 comments on commit 5b96df0

Please sign in to comment.