Skip to content

Commit

Permalink
Documented copy, ref, move in patterns.
Browse files Browse the repository at this point in the history
Closes #3337
  • Loading branch information
jesse99 committed Nov 18, 2012
1 parent e46de53 commit 57c203e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion doc/rust.md
Expand Up @@ -2206,7 +2206,12 @@ fn main() {
}
~~~~

A pattern that's just a variable binding,
Patterns that bind variables default to binding to a copy of the matched value. This can be made
explicit using the ```copy``` keyword, changed to bind to a borrowed pointer by using the ```ref```
keyword, or to a mutable borrowed pointer using ```ref mut```, or the value can be moved into
the new binding using ```move```.

A pattern that's just an identifier,
like `Nil` in the previous answer,
could either refer to an enum variant that's in scope,
or bind a new variable.
Expand Down

0 comments on commit 57c203e

Please sign in to comment.