File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ let y = &mut x;
46
46
<!-- bind `y` to something else (`y = &mut z`), but you can mutate the thing that’s -->
47
47
<!-- bound to `y` (`*y = 5`). A subtle distinction. -->
48
48
` y ` はミュータブル参照へのイミュータブルな束縛であり、 ` y ` を他の束縛に変える(` y = &mut z ` )ことはできません。
49
- しかし、` y ` に束縛されているものを変化させること(` *y = 5 ` )は可能です。
49
+ しかし、` y ` に束縛されているものを変化させること(` *y = 5 ` )は可能です。微妙な区別です。
50
50
51
51
<!-- Of course, if you need both: -->
52
52
もちろん、両方が必要ならば:
@@ -123,7 +123,7 @@ let y = x.clone();
123
123
<!-- the structure itself. It’s not user facing. For this reason, it hands out `&T` -->
124
124
<!-- with `clone()`. If it handed out `&mut T`s, though, that would be a problem. -->
125
125
つまり、「イミュータビリティ」の真の定義はこうです: これは2箇所から指されても安全ですか?
126
- ` Arc<T> ` の例では、イエス: 変更は完全にそれ自身の構造の内側で行われます。ユーザ向いではありません 。
126
+ ` Arc<T> ` の例では、イエス: 変更は完全にそれ自身の構造の内側で行われます。ユーザからは見えません 。
127
127
このような理由により、 ` clone() ` を用いて ` T& ` を配るのです。仮に ` &mut T ` を配ってしまうと、
128
128
問題になるでしょう。
129
129
(訳注: ` Arc<T> ` を用いて複数スレッドにイミュータブル参照を配布し、スレッド間でオブジェクトを共有できます。)
You can’t perform that action at this time.
0 commit comments