Skip to content

Commit 53f5dee

Browse files
committed
Brush up the translation of Associated Types (1.9)
1 parent 2ddd2ca commit 53f5dee

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

1.9/ja/book/associated-types.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ trait Graph {
5252
```
5353

5454
<!-- Now, our clients can be abstract over a given `Graph`: -->
55-
こうすると、利用者側では、個々の `Graph` をより抽象的なものとして扱えます:
55+
こうすると、使う側では、個々の `Graph` をより抽象的なものとして扱えます:
5656

5757
```rust,ignore
5858
fn distance<G: Graph>(graph: &G, start: &G::N, end: &G::N) -> u32 { ... }
@@ -88,7 +88,7 @@ trait Graph {
8888
<!-- if we wanted our `N` type to implement `Display`, so we can print the nodes out, -->
8989
<!-- we could do this: -->
9090
これらの `type` 宣言は、関数で利用できるものと同じものが全て利用できます。
91-
たとえば、頂点を表示するために、`N` 型に `Display` を実装してほしい場合は、以下のように指定できます:
91+
たとえば、頂点を表示するため `N` 型には `Display` を実装してほしいなら、以下のように指定できます:
9292

9393
```rust
9494
use std::fmt;
@@ -142,7 +142,8 @@ impl Graph for MyGraph {
142142
<!-- `struct`s, one for the graph, one for the node, and one for the edge. If it made -->
143143
<!-- more sense to use a different type, that would work as well, we’re going to -->
144144
<!-- use `struct`s for all three here. -->
145-
この少し単純すぎる実装は、常に `true` と空の `Vec<Edge>` を返しますが、どのように定義したら良いかのアイデアをくれます。
145+
この、いささか単純過ぎる実装では、常に `true` と空の `Vec<Edge>` を返します。
146+
しかし、関連型をどう定義したらよいのかを教えてくれます。
146147
まず、はじめに3つの `struct` が必要です。
147148
グラフのためにひとつ、頂点のためにひとつ、辺のためにひとつです。
148149
もし異なる型を利用するのが適切ならば、そうしても構いません。

0 commit comments

Comments
 (0)