Documented copy, ref, move in patterns.

Closes #3337
This commit is contained in:
Jesse Jones 2012-11-18 15:26:12 -08:00
parent e46de5381b
commit 57c203ef7f

View file

@ -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.