Skip to content

Commit 2073b95

Browse files
committed
reflect reviews
1 parent b34f49d commit 2073b95

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

1.6/ja/book/traits.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl Circle {
2828
<!-- Traits are similar, except that we first define a trait with a method
2929
signature, then implement the trait for a type. In this example, we implement the trait `HasArea` for `Circle`: -->
3030
始めにトレイトをメソッドのシグネチャと共に定義し、続いてある型のためにトレイトを実装するという流れを除けばトレイトはメソッド構文に似ています。
31-
この例では、 `Circle` のために `HasArea` トレイトを実装しています。
31+
この例では、 `Circle` `HasArea` トレイトを実装しています。
3232

3333
```rust
3434
struct Circle {
@@ -178,7 +178,7 @@ error: the trait `HasArea` is not implemented for the type `_` [E0277]
178178
<!-- Your generic structs can also benefit from trait bounds. All you need to
179179
do is append the bound when you declare type parameters. Here is a new
180180
type `Rectangle<T>` and its operation `is_square()`: -->
181-
ジェネリック構造体もトレイト境界による恩恵を受けることができます。あなたがしなければならないのは型パラメータを宣言する際に境界を追加することだけです。以下が新しい型 `Rectangle<T>` とそのメソッド `is_square()` です。
181+
ジェネリック構造体もトレイト境界による恩恵を受けることができます。型パラメータを宣言する際に境界を追加するだけで良いのです。以下が新しい型 `Rectangle<T>` とそのメソッド `is_square()` です。
182182

183183
```rust
184184
struct Rectangle<T> {
@@ -219,7 +219,7 @@ impl<T: PartialEq> Rectangle<T> { ... }
219219

220220
<!-- Now, a rectangle can be defined in terms of any type that can be compared for
221221
equality. -->
222-
今、比較して等しさを確かめることのできる型について長方形を定義できました
222+
これで、長方形を等値性の比較できる任意の型として定義できました
223223

224224
[PartialEq]: ../core/cmp/trait.PartialEq.html
225225

@@ -228,7 +228,7 @@ precision—really, objects of pretty much any type—as long as they can be
228228
compared for equality. Could we do the same for our `HasArea` structs, `Square`
229229
and `Circle`? Yes, but they need multiplication, and to work with that we need
230230
to know more about [operator traits][operators-and-overloading]. -->
231-
上記の例では任意の精度を許容する `Rectangle` 構造体を新たに定義しました-実のところ、比較して等しさを確かめることのできるほぼ全ての型に対して利用可能なオブジェクトです。同じことを `Square``Circle` のような `HasArea` を実装する構造体に対してできるでしょうか?可能では有りますが乗算が必要になるため、それをするには [オペレータトレイト][operators-and-overloading] についてより詳しく知らなければなりません。
231+
上記の例では任意の精度の数値を受け入れる `Rectangle` 構造体を新たに定義しました-実は、等値性を比較できるほぼ全ての型に対して利用可能なオブジェクトです。同じことを `Square``Circle` のような `HasArea` を実装する構造体に対してできるでしょうか?可能では有りますが乗算が必要になるため、それをするには [オペレータトレイト][operators-and-overloading] についてより詳しく知らなければなりません。
232232

233233
[operators-and-overloading]: operators-and-overloading.html
234234

@@ -238,7 +238,7 @@ to know more about [operator traits][operators-and-overloading]. -->
238238
<!-- So far, we’ve only added trait implementations to structs, but you can
239239
implement a trait for any type. So technically, we _could_ implement `HasArea`
240240
for `i32`: -->
241-
ここまでで、構造体へトレイトの実装を追加することだけを説明してきましたが、あらゆる型についてトレイトを実装することもできます。技術的には、 `i32` のための `HasArea` を実装することも _できなくはない_ です。
241+
ここまでで、構造体へトレイトの実装を追加することだけを説明してきましたが、あらゆる型についてトレイトを実装することもできます。技術的には、 `i32` `HasArea` を実装することも _できなくはない_ です。
242242

243243
```rust
244244
trait HasArea {
@@ -266,13 +266,13 @@ that if the trait isn’t defined in your scope, it doesn’t apply. Here’s an
266266
example: the standard library provides a [`Write`][write] trait which adds
267267
extra functionality to `File`s, for doing file I/O. By default, a `File`
268268
won’t have its methods: -->
269-
ここまでくると何でもありなように思えますが、手が負えなくなることを防ぐためにトレイトの実装周りには2つの制限が設けられています。第1に、あなたのスコープ内で定義されていないトレイトは適用されません。例えば、標準ライブラリは `File` にI/O機能を追加するための `Write` トレイトを提供しています。デフォルトでは、 `File` はそのメソッドを持っていません
269+
ここまでくると世紀末感漂いますが、手が負えなくなることを防ぐためにトレイトの実装周りには2つの制限が設けられています。第1に、あなたのスコープ内で定義されていないトレイトは適用されません。例えば、標準ライブラリは `File` にI/O機能を追加するための `Write` トレイトを提供しています。デフォルトでは、 `File` `Writes` で定義されるメソッド群を持っていません
270270

271271
[write]: ../std/io/trait.Write.html
272272

273273
```rust,ignore
274274
let mut f = std::fs::File::open("foo.txt").expect("Couldn’t open foo.txt");
275-
# let buf = b"whatever"; // byte string literal. buf: &[u8; 8]
275+
# // let buf = b"whatever"; // byte string literal. buf: &[u8; 8]
276276
let buf = b"whatever"; // buf: &[u8; 8] はバイト文字列リテラルです。
277277
let result = f.write(buf);
278278
# // result.unwrap(); // ignore the error
@@ -400,7 +400,7 @@ fn main() {
400400
All you need to do is leave off the bounds when defining your type parameters,
401401
and then add `where` after the parameter list. For longer lists, whitespace can
402402
be added: -->
403-
`foo()` は先程見せたままの構文で、 `bar()``where` 節を用いています。あなたに必要なのは型パラメータを定義する際に境界の設定をせず、引数リストの後ろに `where` を追加することだけです。長いリストであれば、空白を加えることもできます。
403+
`foo()` は先程見せたままの構文で、 `bar()``where` 節を用いています。型パラメータを定義する際に境界の設定をせず、引数リストの後ろに `where` を追加するだけで良いのです。長いリストであれば、空白を加えることもできます。
404404

405405
```rust
406406
use std::fmt::Debug;
@@ -416,7 +416,7 @@ fn bar<T, K>(x: T, y: K)
416416
```
417417

418418
<!-- This flexibility can add clarity in complex situations. -->
419-
この柔軟性により複雑な状況であっても明瞭さを付加することができます
419+
この柔軟性により複雑な状況であっても可読性を改善できます
420420

421421
<!-- `where` is also more powerful than the simpler syntax. For example: -->
422422
また、`where` は基本の構文よりも強力です。例えば、

0 commit comments

Comments
 (0)