@@ -178,23 +178,23 @@ <h1><a class="header" href="#動的サイズの型dst-dynamically-sized-type" id
178178<!--
179179There are two major DSTs exposed by the language: trait objects, and slices.
180180-->
181- < p > 言語が提供する DST のうち重要なものが 2 つあります。trait オブジェクトとスライスです 。</ p >
181+ < p > 言語が提供する DST のうち重要なものが 2 つあります。トレイトオブジェクトとスライスです 。</ p >
182182<!--
183183A trait object represents some type that implements the traits it specifies.
184184The exact original type is *erased* in favor of runtime reflection
185185with a vtable containing all the information necessary to use the type.
186186This is the information that completes a trait object: a pointer to its vtable.
187187-->
188- < p > Trait オブジェクトは、それが指す Trait を実装するある型を表現します 。
188+ < p > トレイトオブジェクトは、それが指すトレイトを実装するある型を表現します 。
189189元となった型は消去されますが、vtable とリフレクションとによって実行時にはその型を利用することができます。
190190つまり、Trait オブジェクトを補完する情報とは vtable へのポインタとなります。</ p >
191191<!--
192192A slice is simply a view into some contiguous storage -- typically an array or
193193`Vec`. The information that completes a slice is just the number of elements
194194it points to.
195195-->
196- < p > スライスとは、単純にある連続したスペース(通常はアレイか < code > Vec</ code > )のビューです。
197- スライスを補完する情報とは、単にポインタが指すエレメントの数です 。</ p >
196+ < p > スライスとは、単純にある連続したスペース(通常は配列か < code > Vec</ code > )のビューです。
197+ スライスを補完する情報とは、単にポインタが指す要素の数です 。</ p >
198198<!--
199199Structs can actually store a single DST directly as their last field, but this
200200makes them a DST as well:
@@ -231,8 +231,8 @@ <h1><a class="header" href="#サイズが-0-の型zst-zero-sized-type" id="サ
231231// すべてのフィールドのサイズがない = サイズ 0
232232struct Baz {
233233 foo: Foo,
234- qux: (), // empty tuple has no size
235- baz: [u8; 0], // empty array has no size
234+ qux: (), // 空のタプルにはサイズがありません
235+ baz: [u8; 0], // 空の配列にはサイズがありません
236236}
237237#}</ code > </ pre > </ pre >
238238<!--
@@ -244,7 +244,7 @@ <h1><a class="header" href="#サイズが-0-の型zst-zero-sized-type" id="サ
244244type, so anything that loads it can just produce it from the aether -- which is
245245also a no-op since it doesn't occupy any space.
246246-->
247- < p > サイズ 0 の型(ZST)は、当然ながら、それ自体ではほとんど価値があありません 。
247+ < p > サイズ 0 の型(ZST)は、当然ながら、それ自体ではほとんど価値がありません 。
248248しかし、多くの興味深いレイアウトの選択肢と組み合わせると、ZST が潜在的に役に立つことがいろいろな
249249ケースで明らかになります。Rust は、ZST を生成したり保存したりするオペレーションが no-op に
250250還元できることを理解しています。
@@ -261,7 +261,7 @@ <h1><a class="header" href="#サイズが-0-の型zst-zero-sized-type" id="サ
261261-->
262262< p > 究極の ZST の利用法として、Set と Map を考えてみましょう。
263263< code > Map<Key, Value></ code > があるときに、< code > Set<Key></ code > を < code > Map<Key, UselessJunk></ code > の
264- 簡単なラッパーとして実装することはよくあります 。
264+ 簡単なラッパとして実装することはよくあります 。
265265多くの言語では、UselessJunk のスペースを割り当てる必要があるでしょうし、
266266結果的に使わない UselessJunk を保存したり読み込んだりする必要もあるでしょう。
267267こういったことが不要であると示すのはコンパイラにとっては難しい仕事でしょう。</ p >
@@ -283,7 +283,7 @@ <h1><a class="header" href="#サイズが-0-の型zst-zero-sized-type" id="サ
283283may return `nullptr` when a zero-sized allocation is requested, which is
284284indistinguishable from out of memory.
285285-->
286- < p > 安全なコードは ZST について心配する必要はありませんが、< em > 危険な </ em > コードは
286+ < p > 安全なコードは ZST について心配する必要はありませんが、< em > アンセーフな </ em > コードは
287287サイズ 0 の型を使った時の結果について注意しなくてはなりません。
288288特に、ポインタのオフセットは no-op になることや、
289289(Rust のデフォルトである jemalloc を含む)標準的なメモリアロケータは、
@@ -321,7 +321,7 @@ <h1><a class="header" href="#空の型" id="空の型">空の型</a></h1>
321321特定のケースでは絶対に失敗しないことがわかっているとします。
322322< code > Result<T, Void></ code > を返すことで、この事実を型レベルで伝えることが可能です。
323323Void 型の値を提供することはできないので、この Result は Err に< em > なり得ないと静的にわかります</ em > 。
324- そのため、この API の利用者は、自信を持って Result を unwrap することができます 。</ p >
324+ そのため、この API の利用者は、自信を持って Result をアンラップすることができます 。</ p >
325325<!--
326326In principle, Rust can do some interesting analyses and optimizations based
327327on this fact. For instance, `Result<T, Void>` could be represented as just `T`,
@@ -343,18 +343,18 @@ <h1><a class="header" href="#空の型" id="空の型">空の型</a></h1>
343343the ability to be confident that certain situations are statically impossible.
344344-->
345345< p > ただし、どちらの例も現時点では動きません。
346- つまり、Void 型による利点は、静的な解析によて 、特定の状況が起こらないと確実に言えることだけです。</ p >
346+ つまり、Void 型による利点は、静的な解析によって 、特定の状況が起こらないと確実に言えることだけです。</ p >
347347<!--
348348One final subtle detail about empty types is that raw pointers to them are
349349actually valid to construct, but dereferencing them is Undefined Behavior
350350because that doesn't actually make sense. That is, you could model C's `void *`
351351type with `*const Void`, but this doesn't necessarily gain anything over using
352352e.g. `*const ()`, which *is* safe to randomly dereference.
353353-->
354- < p > 最後に細かいことを一つ。空の型を指す生のポインタを構成することは有効ですが 、
355- それをデリファレンスすることは 、意味がないので、未定義の挙動となります。
354+ < p > 最後に細かいことを一つ。空の型を指す生ポインタを構成することは有効ですが 、
355+ それを参照外しすることは 、意味がないので、未定義の挙動となります。
356356つまり、C における < code > void *</ code > と同じような意味で < code > *const Void</ code > を使うこと出来ますが、
357- これは、< em > 安全に</ em > デリファレンスできる型 (例えば < code > *const ()</ code > )と比べて何も利点はありません。</ p >
357+ これは、< em > 安全に</ em > 参照外しできる型 (例えば < code > *const ()</ code > )と比べて何も利点はありません。</ p >
358358
359359 </ main >
360360
0 commit comments