@@ -52,7 +52,7 @@ trait Graph {
52
52
```
53
53
54
54
<!-- Now, our clients can be abstract over a given `Graph`: -->
55
- こうすると、利用者側では 、個々の ` Graph ` をより抽象的なものとして扱えます:
55
+ こうすると、使う側では 、個々の ` Graph ` をより抽象的なものとして扱えます:
56
56
57
57
``` rust,ignore
58
58
fn distance<G: Graph>(graph: &G, start: &G::N, end: &G::N) -> u32 { ... }
@@ -88,7 +88,7 @@ trait Graph {
88
88
<!-- if we wanted our `N` type to implement `Display`, so we can print the nodes out, -->
89
89
<!-- we could do this: -->
90
90
これらの ` type ` 宣言は、関数で利用できるものと同じものが全て利用できます。
91
- たとえば、頂点を表示するために、 ` N ` 型に ` Display ` を実装してほしい場合は 、以下のように指定できます:
91
+ たとえば、頂点を表示するため ` N ` 型には ` Display ` を実装してほしいなら 、以下のように指定できます:
92
92
93
93
``` rust
94
94
use std :: fmt;
@@ -142,7 +142,8 @@ impl Graph for MyGraph {
142
142
<!-- `struct`s, one for the graph, one for the node, and one for the edge. If it made -->
143
143
<!-- more sense to use a different type, that would work as well, we’re going to -->
144
144
<!-- use `struct`s for all three here. -->
145
- この少し単純すぎる実装は、常に ` true ` と空の ` Vec<Edge> ` を返しますが、どのように定義したら良いかのアイデアをくれます。
145
+ この、いささか単純過ぎる実装では、常に ` true ` と空の ` Vec<Edge> ` を返します。
146
+ しかし、関連型をどう定義したらよいのかを教えてくれます。
146
147
まず、はじめに3つの ` struct ` が必要です。
147
148
グラフのためにひとつ、頂点のためにひとつ、辺のためにひとつです。
148
149
もし異なる型を利用するのが適切ならば、そうしても構いません。
0 commit comments