Skip to content

Commit 384dcfa

Browse files
m-shakatatsuya6502
andauthored
Apply suggestions from code review
Co-authored-by: Tatsuya Kawano <[email protected]>
1 parent 9b5a818 commit 384dcfa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ch15-02-deref.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Listing 15-8 defines a `MyBox<T>` type in the same way. We’ll also define a
186186
`new` function to match the `new` function defined on `Box<T>`.
187187
-->
188188

189-
`Box<T>`型はとどのつまり、1要素のタプル構造体として定義されています。なのでリスト15-8ではそれと同じように`MyBox<T>`型を定義しています。
189+
`Box<T>`型は突き詰めると(訳註:データがヒープに置かれることを無視すると)1要素のタプル構造体のような定義になります。なのでリスト15-8ではそのように`MyBox<T>`型を定義しています。
190190
また、`Box<T>`に定義された`new`関数に対応する`new`関数も定義しています。
191191

192192
<!--
@@ -349,7 +349,8 @@ that implements `Deref` and call the `deref` method to get a `&` reference that
349349
it knows how to dereference.
350350
-->
351351

352-
`Deref`がなければ、コンパイラは`&`参照しか参照外しできなくなります。`deref`メソッドのおかげでコンパイラは、どんな型であれ`Deref`を実装していれば`deref`メソッドを呼び出して`&`参照を得ることができます。コンパイラはその参照を外す方法を知っているのです。
352+
`Deref`トレイトがないと、コンパイラは`&`参照しか参照外しできません。
353+
`deref`メソッドのおかげで、コンパイラは`Deref`を実装している型の値を取り、`deref`メソッドを呼ぶことで、参照外しが可能な`&`参照を得られるようになります。
353354

354355
<!--
355356
When we entered `*y` in Listing 15-9, behind the scenes Rust actually ran this

0 commit comments

Comments
 (0)