1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-05-16 07:36:05 +02:00

ja: Translate Chapter 24 (Generics) (#1283)

Hi JP translation folks (#652). Here's a MR for Generics chapter. Could
you take a look at it? Thank you!
This commit is contained in:
Kanta Yamaoka (山岡幹太) 2023-10-05 07:58:20 +09:00 committed by GitHub
parent 9d45db83b1
commit d59cb116b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8528,10 +8528,14 @@ msgid ""
"Rust support generics, which lets you abstract algorithms or data structures " "Rust support generics, which lets you abstract algorithms or data structures "
"(such as sorting or a binary tree) over the types used or stored." "(such as sorting or a binary tree) over the types used or stored."
msgstr "" msgstr ""
"Rustはジェネリクス(generics)をサポートします。これにより、使用または保存す"
"る型に関してアルゴリズムやデータ構造(ソートアルゴリズムや、二分木など)を抽"
"象化することができます。"
#: src/generics/data-types.md:3 #: src/generics/data-types.md:3
msgid "You can use generics to abstract over the concrete field type:" msgid "You can use generics to abstract over the concrete field type:"
msgstr "" msgstr ""
"ジェネリクスを使って、具体的なフィールドの型を抽象化することができます:"
#: src/generics/data-types.md:5 #: src/generics/data-types.md:5
msgid "" msgid ""
@ -8553,14 +8557,16 @@ msgstr ""
#: src/generics/data-types.md:21 #: src/generics/data-types.md:21
msgid "Try declaring a new variable `let p = Point { x: 5, y: 10.0 };`." msgid "Try declaring a new variable `let p = Point { x: 5, y: 10.0 };`."
msgstr "" msgstr ""
"次のような新しい変数を宣言してみてください `let p = Point { x: 5, y: 10.0 };"
"`."
#: src/generics/data-types.md:23 #: src/generics/data-types.md:23
msgid "Fix the code to allow points that have elements of different types." msgid "Fix the code to allow points that have elements of different types."
msgstr "" msgstr "異なる型の要素を持つ点を許容するように、コードを修正してください。"
#: src/generics/methods.md:3 #: src/generics/methods.md:3
msgid "You can declare a generic type on your `impl` block:" msgid "You can declare a generic type on your `impl` block:"
msgstr "" msgstr "`impl`に対して、ジェネリックな型を宣言することもできます:"
#: src/generics/methods.md:5 #: src/generics/methods.md:5
msgid "" msgid ""
@ -8588,30 +8594,40 @@ msgid ""
"_Q:_ Why `T` is specified twice in `impl<T> Point<T> {}`? Isn't that " "_Q:_ Why `T` is specified twice in `impl<T> Point<T> {}`? Isn't that "
"redundant?" "redundant?"
msgstr "" msgstr ""
"_Q:_ なぜ`T`は2回も `impl<T> Point<T> {}` において指定されたのでしょうか?冗"
"長ではありませんか?"
#: src/generics/methods.md:26 #: src/generics/methods.md:26
msgid "" msgid ""
"This is because it is a generic implementation section for generic type. " "This is because it is a generic implementation section for generic type. "
"They are independently generic." "They are independently generic."
msgstr "" msgstr ""
"なぜなら、これはジェネリクスに対してのジェネリックな実装の箇所だからです。そ"
"れらは独立してジェネリックです。"
#: src/generics/methods.md:27 #: src/generics/methods.md:27
msgid "It means these methods are defined for any `T`." msgid "It means these methods are defined for any `T`."
msgstr "" msgstr ""
"つまり、そのようなメソッドは任意の`T`に対して定義されるということです。"
#: src/generics/methods.md:28 #: src/generics/methods.md:28
msgid "It is possible to write `impl Point<u32> { .. }`. " msgid "It is possible to write `impl Point<u32> { .. }`. "
msgstr "" msgstr "`impl Point<u32> { .. }`のように書くことも可能です。 "
#: src/generics/methods.md:29 #: src/generics/methods.md:29
msgid "" msgid ""
"`Point` is still generic and you can use `Point<f64>`, but methods in this " "`Point` is still generic and you can use `Point<f64>`, but methods in this "
"block will only be available for `Point<u32>`." "block will only be available for `Point<u32>`."
msgstr "" msgstr ""
"`Point`はそれでもなおジェネリックであり、 `Point<f64>`を使うことができます。"
"しかし、このブロックでのメソッドは`Point<u32>`に対してのみ利用可能となりま"
"す。"
#: src/generics/monomorphization.md:3 #: src/generics/monomorphization.md:3
msgid "Generic code is turned into non-generic code based on the call sites:" msgid "Generic code is turned into non-generic code based on the call sites:"
msgstr "" msgstr ""
"ジェネリクスのコードは呼び出し箇所に基づいて、ジェネリックでないコードに変換"
"されます:"
#: src/generics/monomorphization.md:5 #: src/generics/monomorphization.md:5
msgid "" msgid ""
@ -8625,7 +8641,7 @@ msgstr ""
#: src/generics/monomorphization.md:12 #: src/generics/monomorphization.md:12
msgid "behaves as if you wrote" msgid "behaves as if you wrote"
msgstr "" msgstr "上のコードは、次のように書いた時と同じように動作します"
#: src/generics/monomorphization.md:14 #: src/generics/monomorphization.md:14
msgid "" msgid ""
@ -8652,6 +8668,8 @@ msgid ""
"This is a zero-cost abstraction: you get exactly the same result as if you " "This is a zero-cost abstraction: you get exactly the same result as if you "
"had hand-coded the data structures without the abstraction." "had hand-coded the data structures without the abstraction."
msgstr "" msgstr ""
"これはゼロコスト抽象化です:抽象化なしに手作業でデータ構造を書いたときと、全"
"く同じ結果を得ることができます。"
#: src/traits.md:3 #: src/traits.md:3
msgid "" msgid ""