File tree 1 file changed +8
-7
lines changed 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 1
1
# Partial moves
2
2
3
- Pattern bindings can have ` by-move ` and ` by-reference ` bindings at
4
- the same time which is used in [ destructuring] . Using these pattern
5
- will result in partial move for the variable, which means that part
6
- of the variable is moved while other parts stayed. In this case, the
7
- parent variable cannot be used afterwards as a whole. However, parts
8
- of it that are referenced and not moved can be used.
3
+ Within the [ destructuring] of a single variable, both ` by-move ` and
4
+ ` by-reference ` pattern bindings can be used at the same time. Doing
5
+ this will result in a _ partial move_ of the variable, which means
6
+ that parts of the variable will be moved while other parts stay. In
7
+ such a case, the parent variable cannot be used afterwards as a
8
+ whole, however the parts that are only referenced (and not moved)
9
+ can still be used.
9
10
10
11
``` rust,editable
11
12
fn main() {
@@ -37,4 +38,4 @@ fn main() {
37
38
### See also:
38
39
[ destructuring] [ destructuring ]
39
40
40
- [ destructuring ] : ../../flow_control/match/destructuring.md
41
+ [ destructuring ] : ../../flow_control/match/destructuring.md
You can’t perform that action at this time.
0 commit comments