From 65562046464c62814f1c1052584d9fd7f27c5008 Mon Sep 17 00:00:00 2001 From: marcusdunn Date: Sun, 16 May 2021 20:22:18 -0700 Subject: [PATCH 1/3] added an example for binding after @ --- src/patterns.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/patterns.md b/src/patterns.md index 7676d5255..7ec9a4e53 100644 --- a/src/patterns.md +++ b/src/patterns.md @@ -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` the the final element + whole @ [.., last] => println!("the last element of {:?} is {}", whole, last) + rest => println!("{:?}", rest), } From 0ca365f49371b615d1669d648aff4533d343b1df Mon Sep 17 00:00:00 2001 From: marcusdunn Date: Sun, 16 May 2021 20:25:01 -0700 Subject: [PATCH 2/3] removed repeated word --- src/patterns.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/patterns.md b/src/patterns.md index 7ec9a4e53..16cfac870 100644 --- a/src/patterns.md +++ b/src/patterns.md @@ -384,7 +384,7 @@ 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` the the final element + // 'whole' is the entire slice and `last` is the final element whole @ [.., last] => println!("the last element of {:?} is {}", whole, last) rest => println!("{:?}", rest), From 702bad4479c1a79fc386bde916a5a21deafd75d8 Mon Sep 17 00:00:00 2001 From: marcusdunn Date: Sun, 16 May 2021 20:33:33 -0700 Subject: [PATCH 3/3] added a comma --- src/patterns.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/patterns.md b/src/patterns.md index 16cfac870..43fde6e7a 100644 --- a/src/patterns.md +++ b/src/patterns.md @@ -385,7 +385,7 @@ match slice { ["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) + whole @ [.., last] => println!("the last element of {:?} is {}", whole, last), rest => println!("{:?}", rest), }