Skip to content

Reformulated text for redability #1429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/scope/move/partial_move.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Partial moves

Pattern bindings can have `by-move` and `by-reference` bindings at
the same time which is used in [destructuring]. Using these pattern
will result in partial move for the variable, which means that part
of the variable is moved while other parts stayed. In this case, the
parent variable cannot be used afterwards as a whole. However, parts
of it that are referenced and not moved can be used.
Within the [destructuring] of a single variable, both `by-move` and
`by-reference` pattern bindings can be used at the same time. Doing
this will result in a _partial move_ of the variable, which means
that parts of the variable will be moved while other parts stay. In
such a case, the parent variable cannot be used afterwards as a
whole, however the parts that are only referenced (and not moved)
can still be used.

```rust,editable
fn main() {
Expand Down Expand Up @@ -37,4 +38,4 @@ fn main() {
### See also:
[destructuring][destructuring]

[destructuring]: ../../flow_control/match/destructuring.md
[destructuring]: ../../flow_control/match/destructuring.md