Skip to content

Commit

Permalink
Merge pull request #3800 from pitaj/patch-1
Browse files Browse the repository at this point in the history
Fix misleading explanation of comma in `$(),*`
  • Loading branch information
chriskrycho authored Dec 12, 2024
2 parents b195aeb + fa7e1c3 commit e78a93c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ch20-06-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ for use in the replacement code. Within `$()` is `$x:expr`, which matches any
Rust expression and gives the expression the name `$x`.

The comma following `$()` indicates that a literal comma separator character
could optionally appear after the code that matches the code in `$()`. The `*`
specifies that the pattern matches zero or more of whatever precedes the `*`.
must appear between each instance of the code that matches the code within
`$()`. The `*` specifies that the pattern matches zero or more of whatever
precedes the `*`.

When we call this macro with `vec![1, 2, 3];`, the `$x` pattern matches three
times with the three expressions `1`, `2`, and `3`.
Expand Down

0 comments on commit e78a93c

Please sign in to comment.