Skip to content

Commit 0cd56e4

Browse files
authored
Merge pull request #113 from KANIYONIKA/Translate-scope/move/partial_move.md
Translate scope/move/partial_move.md
2 parents 79c3ec5 + 5927f18 commit 0cd56e4

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

TranslationTable.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
| parametric polymorphism | パラメトリック多相
137137
| parse | パース、パースする
138138
| patch | パッチ
139+
| partial moves | 部分的ムーブ
139140
| pattern | パターン
140141
| performance | パフォーマンス
141142
| platform | プラットフォーム

src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@
254254
- [RAII](scope/raii.md)
255255
- [所有権とムーブ](scope/move.md)
256256
- [ミュータビリティ](scope/move/mut.md)
257-
- [Partial moves](scope/move/partial_move.md)
257+
- [部分的ムーブ](scope/move/partial_move.md)
258258
- [借用](scope/borrow.md)
259259
- [ミュータビリティ](scope/borrow/mut.md)
260260
- [エイリアス](scope/borrow/alias.md)

src/scope/move/partial_move.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1+
<!--
12
# Partial moves
3+
-->
4+
# 部分的ムーブ
25

6+
<!--
37
Within the [destructuring] of a single variable, both `by-move` and
48
`by-reference` pattern bindings can be used at the same time. Doing
59
this will result in a _partial move_ of the variable, which means
610
that parts of the variable will be moved while other parts stay. In
711
such a case, the parent variable cannot be used afterwards as a
812
whole, however the parts that are only referenced (and not moved)
913
can still be used.
14+
-->
15+
1つの変数の [デストラクト] の中で、 `ムーブ``参照` の両方のパターンバインディングを同時に使用することができます。両方を使用すると、変数の一部がムーブされ、他の部分が参照として残るという変数の部分的ムーブが発生した状態になります。変数の部分的ムーブが発生すると親変数はその後使用できませんが、参照されているだけの部分(ムーブされていない部分)は使用することができます。
16+
17+
[デストラクト]: ../../flow_control/match/destructuring.md
1018

1119
```rust,editable
1220
fn main() {
@@ -22,20 +30,30 @@ fn main() {
2230
};
2331
2432
// `name` is moved out of person, but `age` is referenced
33+
// `name` は person からムーブしたが、 `age` は参照されている
2534
let Person { name, ref age } = person;
2635
2736
println!("The person's age is {}", age);
2837
2938
println!("The person's name is {}", name);
3039
3140
// Error! borrow of partially moved value: `person` partial move occurs
41+
// エラー!部分的ムーブした値の借用:`person` では部分的ムーブが発生している
3242
//println!("The person struct is {:?}", person);
3343
3444
// `person` cannot be used but `person.age` can be used as it is not moved
45+
// `person` は使用できないが、 `person.age` はムーブしていないので使用できる
3546
println!("The person's age from person struct is {}", person.age);
3647
}
3748
```
49+
<!--
3850
### See also:
51+
-->
52+
### 参照
53+
54+
<!--
3955
[destructuring][destructuring]
56+
-->
57+
[デストラクト][destructuring]
4058

41-
[destructuring]: ../../flow_control/match/destructuring.md
59+
[destructuring]: ../../flow_control/match/destructuring.md

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy