Skip to content

付録の和訳を最新版に更新 #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 56 commits into
base: master-ja
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
e685c96
ch02 数当てゲームのプログラミングの和訳を最新版に更新
shinmili May 26, 2024
db3a649
リンク漏れ修正
shinmili Nov 28, 2024
24f5af0
コメントの位置修正
shinmili Dec 26, 2024
cf8947f
ch03 一般的なプログラミングの概念の和訳を最新版に更新
shinmili May 26, 2024
42a63a5
リンク漏れ修正
shinmili Nov 28, 2024
e0d2a48
誤字修正
shinmili Jan 31, 2025
42cf09e
ch04 所有権を理解するの和訳を最新版に更新
shinmili May 26, 2024
138f7fc
コメント閉じ忘れ修正
shinmili Nov 28, 2024
f5f69e9
コードブロックの訳し漏れ修正
shinmili Nov 28, 2024
40d8fd5
ch05 構造体を使用して関係のあるデータを構造化するの和訳を最新版に更新
shinmili May 26, 2024
70c7a13
ch06 Enumとパターンマッチングの和訳を最新版に更新
shinmili May 26, 2024
2f70d34
ch07 肥大化していくプロジェクトをパッケージ、クレート、モジュールを利用して管理するの和訳を最新版に更新
shinmili May 26, 2024
0c0c9d5
消し忘れた段落を削除
shinmili Nov 29, 2024
9eb0aa4
読点の修正
shinmili Nov 29, 2024
1139c13
ch08 一般的なコレクションの和訳を最新版に更新
shinmili May 26, 2024
32a5e00
誤字修正
shinmili Nov 30, 2024
cbd1f9c
消し忘れた段落を削除
shinmili Nov 30, 2024
777e045
コメントの閉じ方の誤りを修正
shinmili Nov 30, 2024
6da5374
修正漏れを修正
shinmili Nov 30, 2024
75aeb75
doc.rust-lang.org 内でのみ機能する相対リンクを修正
shinmili Nov 30, 2024
93e7c99
ch09 エラー処理の和訳を最新版に更新
shinmili May 26, 2024
ee5f863
不要な記号の削除
shinmili Nov 30, 2024
1e6ccf0
消し忘れた段落を削除
shinmili Nov 30, 2024
4e664a9
コメントの位置修正
shinmili Dec 27, 2024
4e3d9ea
ch10 ジェネリック型、トレイト、ライフタイムの和訳を最新版に更新
shinmili May 26, 2024
439eeec
消し忘れた段落を削除
shinmili Nov 30, 2024
fb60cce
ch11 自動テストを書くの和訳を最新版に更新
shinmili May 26, 2024
91b9e1a
見出しレベル誤りを修正
shinmili Dec 1, 2024
059af4e
消し忘れた段落を削除
shinmili Dec 1, 2024
5464a6e
余計な空行を削除
shinmili Dec 27, 2024
06f787f
訳し漏れの翻訳を追加
shinmili Jan 31, 2025
fff91f0
誤字修正
shinmili Jan 31, 2025
57c5588
ch12 入出力プロジェクト: コマンドラインプログラムを構築するの和訳を最新版に更新
shinmili May 26, 2024
e042c99
ch13 関数型言語の機能: イテレータとクロージャの和訳を最新版に更新
shinmili May 26, 2024
4543380
見出しレベル誤りを修正
shinmili Dec 1, 2024
57b18f1
訳し忘れを修正
shinmili Dec 1, 2024
db47fd2
ch14 CargoとCrates.ioについてより詳しくの和訳を最新版に更新
shinmili May 26, 2024
e3bf9f9
ch15 スマートポインタの和訳を最新版に更新
shinmili May 26, 2024
e49e340
消し忘れた段落を削除
shinmili Dec 7, 2024
64432c2
ch16 恐れるな!並行性の和訳を最新版に更新
shinmili May 26, 2024
bd648eb
ch17 Rustのオブジェクト指向プログラミング機能の和訳を最新版に更新
shinmili May 26, 2024
7f4328c
ch18 パターンとマッチングの和訳を最新版に更新
shinmili May 26, 2024
46a06ad
ch19 高度な機能の和訳を最新版に更新
shinmili May 26, 2024
a8f53a5
markdown の誤りを修正
shinmili Dec 8, 2024
e657cc7
消し忘れた段落を削除
shinmili Dec 8, 2024
634ef1a
誤リンク修正
shinmili Jan 31, 2025
7351cd9
ch20 最後のプロジェクト: マルチスレッドのWebサーバを構築するの和訳を最新版に更新
shinmili May 26, 2024
d6477e2
付録A: キーワードの和訳をアップデート
shinmili May 26, 2024
07bc7e9
付録B: 演算子と記号の和訳をアップデート
shinmili May 26, 2024
8a44126
付録C: 導出可能なトレイトの和訳をアップデート
shinmili May 26, 2024
61796c9
付録D: 便利な開発ツールの和訳をアップデート
shinmili May 26, 2024
11c6f83
付録F: 本の翻訳の和訳をアップデート
shinmili May 26, 2024
6fb6df6
付録G: Rustの作られ方と“Nightly Rust”の和訳をアップデート
shinmili May 26, 2024
aceff44
訳し忘れを修正
shinmili Dec 8, 2024
ae12469
表内の行の削除・並び替えに合わせて修正
shinmili Dec 8, 2024
b5c6eaa
消し忘れた見出しを削除
shinmili Dec 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
付録C: 導出可能なトレイトの和訳をアップデート
  • Loading branch information
shinmili committed Feb 4, 2025
commit 8a4412678e4ce2120f6f189b8e7d3a0b9354d49a
90 changes: 57 additions & 33 deletions src/appendix-03-derivable-traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@ library that you can use with `derive`. Each section covers:
* そのトレイトが必要になる処理の例

<!--
If you want different behavior than that provided by the `derive` attribute,
consult the standard library documentation for each trait for details on how to
manually implement them.
If you want different behavior from that provided by the `derive` attribute,
consult the [standard library documentation](../std/index.html)
for each trait for details of how to manually implement them.
-->

`derive`属性が提供する以外の異なる振る舞いが欲しいなら、それらを手動で実装する方法の詳細について、
各トレイトの標準ライブラリのドキュメンテーションを調べてください
`derive`属性が提供するものと異なる振る舞いが欲しいなら、それらを手動で実装する方法の詳細について、
各トレイトの[標準ライブラリのドキュメンテーション](https://doc.rust-lang.org/std/index.html)を調べてください

<!--
The rest of the traits defined in the standard library can’t be implemented on
your types using `derive`. These traits don’t have sensible default behavior,
so it’s up to you to implement them in the way that makes sense for what you’re
trying to accomplish.
These traits listed here are the only ones defined by the standard library that
can be implemented on your types using `derive`. Other traits defined in the
standard library don’t have sensible default behavior, so it’s up to you to
implement them in the way that makes sense for what you’re trying to accomplish.
-->

標準ライブラリで定義されている残りのトレイトは、`derive`で自分の型に実装することはできません
これらのトレイトには知覚できるほどの既定の振る舞いはないので、自分が達成しようしていることに対して
道理が通る方法でそれらを実装するのはあなた次第です。
ここで列挙したトレイトは、標準ライブラリによって`derive`で自分の型に対して実装できると定義されているもののみです
他の標準ライブラリで定義されているトレイトには、分別のあるデフォルトの振る舞いはないので
自分が達成しようしていることに対して、道理が通る方法でそれらを実装するのはあなた次第です。

<!--
An example of a trait that can’t be derived is `Display`, which handles
Expand All @@ -73,12 +73,13 @@ it can’t provide appropriate default behavior for you.
The list of derivable traits provided in this appendix is not comprehensive:
libraries can implement `derive` for their own traits, making the list of
traits you can use `derive` with truly open-ended. Implementing `derive`
involves using a procedural macro, which is covered in Appendix D.
involves using a procedural macro, which is covered in the
[“Macros”][macros] section of Chapter 19.
-->

この付録で提供される導出可能なトレイトのリストは、包括的ではありません: ライブラリは、自身のトレイトに`derive`を実装でき、
`derive`と共に使用できるトレイトのリストが実に限りのないものになってしまうのです。`derive`の実装には、
プロシージャルなマクロが関連します。マクロについては、付録Dで講義します
プロシージャルなマクロが関連します。マクロについては、第19章の[「マクロ」][macros]で講義します

<!--
### `Debug` for Programmer Output
Expand Down Expand Up @@ -210,10 +211,10 @@ enumに導出すると、enum定義で先に定義された列挙子が、後に
<!--
The `PartialOrd` trait is required, for example, for the `gen_range` method
from the `rand` crate that generates a random value in the range specified by a
low value and a high value.
range expression.
-->

`PartialOrd`トレイトが必要になる例には、低い値と高い値で指定される範囲の乱数を生成する`rand`クレートの`gen_range`メソッドが挙げられます。
`PartialOrd`トレイトが必要になる例には、範囲式で指定される範囲の乱数を生成する`rand`クレートの`gen_range`メソッドが挙げられます。

<!--
The `Ord` trait allows you to know that for any two values of the annotated
Expand Down Expand Up @@ -248,13 +249,14 @@ a data structure that stores data based on the sort order of the values.
<!--
The `Clone` trait allows you to explicitly create a deep copy of a value, and
the duplication process might involve running arbitrary code and copying heap
data. See the “Ways Variables and Data Interact: Clone” section in Chapter 4
for more information on `Clone`.
data. See the [“Ways Variables and Data Interact:
Clone”][ways-variables-and-data-interact-clone] section in
Chapter 4 for more information on `Clone`.
-->

`Clone`トレイトにより値のディープコピーを明示的に行うことができ、複製のプロセスは、任意のコードを実行し、
ヒープデータをコピーすることに関係がある可能性があります。`Clone`について詳しくは、
第4章の「変数とデータの相互作用法: Clone」節を参照されたし。
第4章の[「変数とデータの相互作用法: Clone」][ways-variables-and-data-interact-clone]節を参照されたし。

<!--
Deriving `Clone` implements the `clone` method, which when implemented for the
Expand All @@ -279,12 +281,13 @@ returned from `to_vec` will need to own its instances, so `to_vec` calls

<!--
The `Copy` trait allows you to duplicate a value by only copying bits stored on
the stack; no arbitrary code is necessary. See the “Stack-Only Data: Copy”
section in Chapter 4 for more information on `Copy`.
the stack; no arbitrary code is necessary. See the [“Stack-Only Data:
Copy”][stack-only-data-copy] section in Chapter 4 for more
information on `Copy`.
-->

`Copy`トレイトにより、スタックに格納されたビットをコピーするだけで値を複製できます; 任意のコードは必要ありません。
`Copy`について詳しくは、第4章の「スタックのみのデータ: Copy」を参照されたし。
`Copy`について詳しくは、第4章の[「スタックのみのデータ: Copy」][stack-only-data-copy]を参照されたし。

<!--
The `Copy` trait doesn’t define any methods to prevent programmers from
Expand All @@ -297,14 +300,14 @@ very fast.
そのため、全プログラマは、値のコピーは非常に高速であることを前提にすることができます。

<!--
You can derive `Copy` on any type whose parts all implement `Copy`. You can
only apply the `Copy` trait to types that also implement `Clone`, because a
type that implements `Copy` has a trivial implementation of `Clone` that
performs the same task as `Copy`.
You can derive `Copy` on any type whose parts all implement `Copy`. A type that
implements `Copy` must also implement `Clone`, because a type that implements
`Copy` has a trivial implementation of `Clone` that performs the same task as
`Copy`.
-->

部品すべてが`Copy`を実装する任意の型に対して`Copy`を導出することができます。`Clone`も実装する型に対してのみ、
`Copy`トレイトを適用することができます。何故なら、`Copy`を実装する型には、
部品すべてが`Copy`を実装する任意の型に対して`Copy`を導出することができます。
`Copy`を実装する型は、`Clone`も実装しなくてはなりません。何故なら、`Copy`を実装する型には、
`Copy`と同じ作業を行う`Clone`の<ruby>瑣末<rp>(</rp><rt>さまつ</rt><rp>)</rp></ruby>な実装があるからです。

<!--
Expand Down Expand Up @@ -361,7 +364,7 @@ The `Default` trait allows you to create a default value for a type. Deriving
`Default` implements the `default` function. The derived implementation of the
`default` function calls the `default` function on each part of the type,
meaning all fields or values in the type must also implement `Default` to
derive `Default.`
derive `Default`.
-->

`Default`トレイトにより、型に対して既定値を生成できます。`Default`を導出すると、`default`関数を実装します。
Expand All @@ -370,14 +373,16 @@ derive `Default.`

<!--
The `Default::default` function is commonly used in combination with the struct
update syntax discussed in the “Creating Instances From Other Instances With
Struct Update Syntax” section in Chapter 5. You can customize a few fields of a
struct and then set and use a default value for the rest of the fields by using
update syntax discussed in the [“Creating Instances From Other Instances With
Struct Update
Syntax”][creating-instances-from-other-instances-with-struct-update-syntax]
section in Chapter 5. You can customize a few fields of a struct and then
set and use a default value for the rest of the fields by using
`..Default::default()`.
-->

`Default::default`関数は、
第5章の「構造体更新記法で他のインスタンスからインスタンスを生成する」節で議論した構造体更新記法と組み合わせてよく使用されます。
第5章の[「構造体更新記法で他のインスタンスからインスタンスを生成する」][creating-instances-from-other-instances-with-struct-update-syntax]節で議論した構造体更新記法と組み合わせてよく使用されます。
構造体のいくつかのフィールドをカスタマイズし、それから`..Default::default()`を使用して、
残りのフィールドに対して既定値をセットし使用することができます。

Expand All @@ -390,3 +395,22 @@ The `Default` trait is required when you use the method `unwrap_or_default` on

例えば、`Default`トレイトは、`Option<T>`インスタンスに対してメソッド`unwrap_or_default`を使用する時に必要になります。
`Option<T>`が`None`ならば、メソッド`unwrap_or_default`は、`Option<T>`に格納された型`T`に対して`Default::default`の結果を返します。

<!--
[creating-instances-from-other-instances-with-struct-update-syntax]:
ch05-01-defining-structs.html#creating-instances-from-other-instances-with-struct-update-syntax
[stack-only-data-copy]:
ch04-01-what-is-ownership.html#stack-only-data-copy
[ways-variables-and-data-interact-clone]:
ch04-01-what-is-ownership.html#ways-variables-and-data-interact-clone
[macros]: ch19-06-macros.html#macros
-->

[creating-instances-from-other-instances-with-struct-update-syntax]:
ch05-01-defining-structs.html#構造体更新記法で他のインスタンスからインスタンスを生成する
[stack-only-data-copy]:
ch04-01-what-is-ownership.html#スタックのみのデータ-コピー
[ways-variables-and-data-interact-clone]:
ch04-01-what-is-ownership.html#クローンによる変数とデータの相互作用
[macros]: ch19-06-macros.html#マクロ

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy