Skip to content

Commit 1e87879

Browse files
authored
Merge pull request #175 from tatsuya6502/generics-1.9
4.18. Generics (1.9)
2 parents 32cc4ab + 6b94f8d commit 1e87879

File tree

2 files changed

+6
-27
lines changed

2 files changed

+6
-27
lines changed

1.9/ja/book/generics.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Rustでは、ジェネリクスを用いてこれを実現しています。
1414
<!-- Anyway, enough type theory, let’s check out some generic code. Rust’s -->
1515
<!-- standard library provides a type, `Option<T>`, that’s generic: -->
1616
さて、型理論はもう十分です。
17-
続いてジェネリックなコードを幾つか見ていきましょう
17+
続いてジェネリックなコードをいくつか見ていきましょう
1818
Rustが標準ライブラリで提供している型 `Option<T>` はジェネリックです。
1919

2020
```rust
@@ -54,10 +54,10 @@ let x: Option<f64> = Some(5);
5454
// found `core::option::Option<_>` (expected f64 but found integral variable)
5555
```
5656

57-
<!-- That doesn’t mean we can’t make `Option<T>`s that hold an `f64`! They just have -->
57+
<!-- That doesn’t mean we can’t make `Option<T>`s that hold an `f64`! They have -->
5858
<!-- to match up: -->
5959
これは `f64` を保持する `Option<T>` が作れないという意味ではありませんからね!
60-
リテラルと宣言の型をぴったり合わせなければなりません
60+
リテラルと宣言の型を合わせなければなりません
6161

6262
```rust
6363
let x: Option<i32> = Some(5);
@@ -66,7 +66,7 @@ let y: Option<f64> = Some(5.0f64);
6666

6767
<!-- This is just fine. One definition, multiple uses. -->
6868
これだけで結構です。
69-
1つの定義で、多くの用途が得られます
69+
1つの定義で、多くの用途に対応できます
7070

7171
<!-- Generics don’t have to only be generic over one type. Consider another type from Rust’s standard library that’s similar, `Result<T, E>`: -->
7272
ジェネリクスにおいてジェネリックな型は1つまで、といった制限はありません。
@@ -157,9 +157,9 @@ let float_origin = Point { x: 0.0, y: 0.0 };
157157
<!-- and we then use `x: T` in the type declaration, too. -->
158158
関数と同様に、 `<T>` がジェネリックパラメータを宣言する場所であり、型宣言において `x: T` を使うのも同じです。
159159

160-
<!-- When you want to add an implementation for the generic `struct`, you just -->
160+
<!-- When you want to add an implementation for the generic `struct`, you -->
161161
<!-- declare the type parameter after the `impl`: -->
162-
ジェネリックな `struct` に実装を追加したい場合、 `impl` の後に型パラメータを宣言するだけです
162+
ジェネリックな `struct` に実装を追加したい場合、 `impl` の後に型パラメータを宣言します
163163

164164
```rust
165165
# struct Point<T> {

diff-1.6.0..1.9.0/src/doc/book/generics.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)