316 lines
13 KiB
Plaintext
316 lines
13 KiB
Plaintext
|
# Japanese translations for Rust package
|
|||
|
# Copyright (C) 2014 The Rust Project Developers
|
|||
|
# This file is distributed under the same license as the Rust package.
|
|||
|
# Automatically generated, 2014.
|
|||
|
#
|
|||
|
msgid ""
|
|||
|
msgstr ""
|
|||
|
"Project-Id-Version: Rust 0.10-pre\n"
|
|||
|
"POT-Creation-Date: 2014-01-13 12:01+0900\n"
|
|||
|
"PO-Revision-Date: 2014-01-13 12:01+0900\n"
|
|||
|
"Last-Translator: Automatically generated\n"
|
|||
|
"Language-Team: none\n"
|
|||
|
"Language: ja\n"
|
|||
|
"MIME-Version: 1.0\n"
|
|||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
|||
|
"Content-Transfer-Encoding: 8bit\n"
|
|||
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-conditions.md:4 doc/guide-ffi.md:4 doc/guide-lifetimes.md:4
|
|||
|
#: doc/guide-macros.md:4 doc/guide-rustpkg.md:4 doc/guide-tasks.md:4
|
|||
|
#: doc/rust.md:4 doc/rustpkg.md:4 doc/tutorial.md:4
|
|||
|
msgid "# Introduction"
|
|||
|
msgstr "# イントロダクション"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:2
|
|||
|
#, fuzzy
|
|||
|
#| msgid "% The Rust Language Tutorial"
|
|||
|
msgid "% The Rust References and Lifetimes Guide"
|
|||
|
msgstr "% Rust 言語チュートリアル"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:26
|
|||
|
#, fuzzy
|
|||
|
#| msgid "## A minimal example"
|
|||
|
msgid "# By example"
|
|||
|
msgstr "## 最小限の例"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:33
|
|||
|
#, fuzzy
|
|||
|
#| msgid "As an example, consider a simple struct type, `Point`:"
|
|||
|
msgid "As an example, consider a simple struct type `Point`:"
|
|||
|
msgstr "例として、シンプルな構造体型の `Point` について考えます。"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:41
|
|||
|
#, fuzzy
|
|||
|
#| msgid ""
|
|||
|
#| "We can use this simple definition to allocate points in many different "
|
|||
|
#| "ways. For example, in this code, each of these three local variables "
|
|||
|
#| "contains a point, but allocated in a different location:"
|
|||
|
msgid ""
|
|||
|
"We can use this simple definition to allocate points in many different ways. "
|
|||
|
"For example, in this code, each of these three local variables contains a "
|
|||
|
"point, but allocated in a different place:"
|
|||
|
msgstr ""
|
|||
|
"シンプルな定義ですが、この定義を使って `Point` 型のオブジェクトを様々な方法で"
|
|||
|
"割り当てることができます。例えば、このコードの3つのローカル変数は、それぞれ異"
|
|||
|
"なった場所に `Point` 型のオブジェクトを割り当てています。"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:48
|
|||
|
#, fuzzy, no-wrap
|
|||
|
#| msgid "~~~~ {.xfail-test} # struct Point { x: f64, y: f64 } let mut mypoint = Point { x: 1.0, y: 1.0 }; let origin = Point { x: 0.0, y: 0.0 };"
|
|||
|
msgid ""
|
|||
|
"~~~\n"
|
|||
|
"# struct Point {x: f64, y: f64}\n"
|
|||
|
"let on_the_stack : Point = Point {x: 3.0, y: 4.0};\n"
|
|||
|
"let managed_box : @Point = @Point {x: 5.0, y: 1.0};\n"
|
|||
|
"let owned_box : ~Point = ~Point {x: 7.0, y: 9.0};\n"
|
|||
|
"~~~\n"
|
|||
|
msgstr ""
|
|||
|
"~~~~ {.xfail-test}\n"
|
|||
|
"# struct Point { x: f64, y: f64 }\n"
|
|||
|
"let mut mypoint = Point { x: 1.0, y: 1.0 };\n"
|
|||
|
"let origin = Point { x: 0.0, y: 0.0 };"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:60
|
|||
|
#, fuzzy
|
|||
|
#| msgid ""
|
|||
|
#| "Suppose we want to write a procedure that computes the distance between "
|
|||
|
#| "any two points, no matter where they are stored. For example, we might "
|
|||
|
#| "like to compute the distance between `on_the_stack` and `managed_box`, or "
|
|||
|
#| "between `managed_box` and `owned_box`. One option is to define a function "
|
|||
|
#| "that takes two arguments of type point—that is, it takes the points by "
|
|||
|
#| "value. But this will cause the points to be copied when we call the "
|
|||
|
#| "function. For points, this is probably not so bad, but often copies are "
|
|||
|
#| "expensive. So we’d like to define a function that takes the points by "
|
|||
|
#| "pointer. We can use borrowed pointers to do this:"
|
|||
|
msgid ""
|
|||
|
"Suppose we wanted to write a procedure that computed the distance between "
|
|||
|
"any two points, no matter where they were stored. For example, we might like "
|
|||
|
"to compute the distance between `on_the_stack` and `managed_box`, or between "
|
|||
|
"`managed_box` and `owned_box`. One option is to define a function that takes "
|
|||
|
"two arguments of type `Point`—that is, it takes the points by value. But if "
|
|||
|
"we define it this way, calling the function will cause the points to be "
|
|||
|
"copied. For points, this is probably not so bad, but often copies are "
|
|||
|
"expensive. Worse, if the data type contains mutable fields, copying can "
|
|||
|
"change the semantics of your program in unexpected ways. So we'd like to "
|
|||
|
"define a function that takes the points by pointer. We can use references to "
|
|||
|
"do this:"
|
|||
|
msgstr ""
|
|||
|
"`Point` 型のオブジェクトの割り当て先がどこであったとしても利用可能な、任意の "
|
|||
|
"2 点間の距離を計算する処理を書きたいとします。例えば、 `on_the_stack`, "
|
|||
|
"`managed_box` 間や `managed_box`, `owned_box` 間の距離を計算する処理です。 1"
|
|||
|
"つ目の実装方法として、2つの `Point` 型オブジェクトを引数にとる関数を定義する"
|
|||
|
"方法、すなわち、オブジェクトを値で受け渡す方法があります。しかし、この方法で"
|
|||
|
"は関数呼び出し時に `Point` オブジェクトのコピーが行われます。`Point` オブジェ"
|
|||
|
"クトの場合、このような実装はそれほど悪いものではないでしょうが、コピー処理の"
|
|||
|
"コストは高い場合もあります。したがって、`Point` オブジェクトをポインタ渡しす"
|
|||
|
"る関数を定義する必要があります。そのために、借用ポインタを利用することが可能"
|
|||
|
"です。"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:72 doc/tutorial.md:1394
|
|||
|
msgid "Now we can call `compute_distance()` in various ways:"
|
|||
|
msgstr ""
|
|||
|
"上記の `compute_distance()` 関数は、様々な方法で呼び出すことができます。"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:82
|
|||
|
#, fuzzy, no-wrap
|
|||
|
#| msgid "~~~~ {.xfail-test} # struct Point { x: f64, y: f64 } let mut mypoint = Point { x: 1.0, y: 1.0 }; let origin = Point { x: 0.0, y: 0.0 };"
|
|||
|
msgid ""
|
|||
|
"~~~\n"
|
|||
|
"# struct Point {x: f64, y: f64}\n"
|
|||
|
"# let on_the_stack : Point = Point{x: 3.0, y: 4.0};\n"
|
|||
|
"# let managed_box : @Point = @Point{x: 5.0, y: 1.0};\n"
|
|||
|
"# let owned_box : ~Point = ~Point{x: 7.0, y: 9.0};\n"
|
|||
|
"# fn compute_distance(p1: &Point, p2: &Point) -> f64 { 0.0 }\n"
|
|||
|
"compute_distance(&on_the_stack, managed_box);\n"
|
|||
|
"compute_distance(managed_box, owned_box);\n"
|
|||
|
"~~~\n"
|
|||
|
msgstr ""
|
|||
|
"~~~~ {.xfail-test}\n"
|
|||
|
"# struct Point { x: f64, y: f64 }\n"
|
|||
|
"let mut mypoint = Point { x: 1.0, y: 1.0 };\n"
|
|||
|
"let origin = Point { x: 0.0, y: 0.0 };"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:89
|
|||
|
#, fuzzy
|
|||
|
#| msgid ""
|
|||
|
#| "Here the `&` operator is used to take the address of the variable "
|
|||
|
#| "`on_the_stack`; this is because `on_the_stack` has the type `Point` (that "
|
|||
|
#| "is, a struct value) and we have to take its address to get a value. We "
|
|||
|
#| "also call this _borrowing_ the local variable `on_the_stack`, because we "
|
|||
|
#| "are creating an alias: that is, another route to the same data."
|
|||
|
msgid ""
|
|||
|
"Here, the `&` operator takes the address of the variable `on_the_stack`; "
|
|||
|
"this is because `on_the_stack` has the type `Point` (that is, a struct "
|
|||
|
"value) and we have to take its address to get a value. We also call this "
|
|||
|
"_borrowing_ the local variable `on_the_stack`, because we have created an "
|
|||
|
"alias: that is, another name for the same data."
|
|||
|
msgstr ""
|
|||
|
"ここで `&` 演算子は `on_the_stack` 変数のアドレスを取得するために使われていま"
|
|||
|
"す。これは、 `on_the_stack` の型は `Point` (つまり、構造体の値) であり、呼び"
|
|||
|
"出した関数から値を取得させるため、構造体のアドレスを渡す必要があるからです。"
|
|||
|
"値の別名 (エイリアス)、すなわち、同じデータへアクセスするための別の方法を提供"
|
|||
|
"するので、このような操作のことをローカル変数 `on_the_stack` の __借用__ "
|
|||
|
"(_borrowing_) と呼びます。"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:95
|
|||
|
#, fuzzy
|
|||
|
#| msgid ""
|
|||
|
#| "In the case of the boxes `managed_box` and `owned_box`, however, no "
|
|||
|
#| "explicit action is necessary. The compiler will automatically convert a "
|
|||
|
#| "box like `@point` or `~point` to a borrowed pointer like `&point`. This "
|
|||
|
#| "is another form of borrowing; in this case, the contents of the managed/"
|
|||
|
#| "owned box are being lent out."
|
|||
|
msgid ""
|
|||
|
"In contrast, we can pass the boxes `managed_box` and `owned_box` to "
|
|||
|
"`compute_distance` directly. The compiler automatically converts a box like "
|
|||
|
"`@Point` or `~Point` to a reference like `&Point`. This is another form of "
|
|||
|
"borrowing: in this case, the caller lends the contents of the managed or "
|
|||
|
"owned box to the callee."
|
|||
|
msgstr ""
|
|||
|
"ボックスである `managed_box` と `owned_box` の場合は、特に明示的な操作を行う"
|
|||
|
"必要はありません。コンパイラは `@point` や `~point` のようなボックスを自動的"
|
|||
|
"に `&point` のような借用ポインタへと変換します。これは、別の形態の借用 "
|
|||
|
"(borrowing) です。この場合、マネージド/所有ボックスの内容が貸し出されていま"
|
|||
|
"す。"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:105
|
|||
|
#, fuzzy
|
|||
|
#| msgid ""
|
|||
|
#| "Whenever a value is borrowed, there are some limitations on what you can "
|
|||
|
#| "do with the original. For example, if the contents of a variable have "
|
|||
|
#| "been lent out, you cannot send that variable to another task, nor will "
|
|||
|
#| "you be permitted to take actions that might cause the borrowed value to "
|
|||
|
#| "be freed or to change its type. This rule should make intuitive sense: "
|
|||
|
#| "you must wait for a borrowed value to be returned (that is, for the "
|
|||
|
#| "borrowed pointer to go out of scope) before you can make full use of it "
|
|||
|
#| "again."
|
|||
|
msgid ""
|
|||
|
"Whenever a caller lends data to a callee, there are some limitations on what "
|
|||
|
"the caller can do with the original. For example, if the contents of a "
|
|||
|
"variable have been lent out, you cannot send that variable to another task. "
|
|||
|
"In addition, the compiler will reject any code that might cause the borrowed "
|
|||
|
"value to be freed or overwrite its component fields with values of different "
|
|||
|
"types (I'll get into what kinds of actions those are shortly). This rule "
|
|||
|
"should make intuitive sense: you must wait for a borrower to return the "
|
|||
|
"value that you lent it (that is, wait for the reference to go out of scope) "
|
|||
|
"before you can make full use of it again."
|
|||
|
msgstr ""
|
|||
|
"値が借用されている間、借用元の値に対して行える操作がいくらか制限されます。例"
|
|||
|
"えば、変数の内容が貸し出された場合、その変数を他のタスクに送信することはでき"
|
|||
|
"ませんし、借用された値を解放したり、型が変化させるような操作も行うことができ"
|
|||
|
"ません。このルールは理にかなったものでしょう。貸し出した値を最大限に活用する "
|
|||
|
"(make full use of it) ためには、貸し出した値の返却 (借用ポインタが存在するス"
|
|||
|
"コープを抜ける) を待たなければなりません。"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:114
|
|||
|
#, fuzzy
|
|||
|
#| msgid ""
|
|||
|
#| "~~~ # struct Point { x: f64, y: f64 } let point = &@~Point { x: 10f, y: "
|
|||
|
#| "20f }; println(fmt!(\"%f\", point.x)); ~~~"
|
|||
|
msgid ""
|
|||
|
"~~~ # struct Point {x: f64, y: f64} let on_the_stack: Point = Point {x: 3.0, "
|
|||
|
"y: 4.0}; ~~~"
|
|||
|
msgstr ""
|
|||
|
"~~~\n"
|
|||
|
"# struct Point { x: f64, y: f64 }\n"
|
|||
|
"let point = &@~Point { x: 10f, y: 20f };\n"
|
|||
|
"println(fmt!(\"%f\", point.x));\n"
|
|||
|
"~~~"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:124
|
|||
|
#, fuzzy
|
|||
|
#| msgid ""
|
|||
|
#| "~~~ # struct Point { x: f64, y: f64 } let point = &@~Point { x: 10f, y: "
|
|||
|
#| "20f }; println(fmt!(\"%f\", point.x)); ~~~"
|
|||
|
msgid ""
|
|||
|
"~~~ # struct Point {x: f64, y: f64} let on_the_stack2: &Point = &Point {x: "
|
|||
|
"3.0, y: 4.0}; ~~~"
|
|||
|
msgstr ""
|
|||
|
"~~~\n"
|
|||
|
"# struct Point { x: f64, y: f64 }\n"
|
|||
|
"let point = &@~Point { x: 10f, y: 20f };\n"
|
|||
|
"println(fmt!(\"%f\", point.x));\n"
|
|||
|
"~~~"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:134
|
|||
|
#, fuzzy
|
|||
|
#| msgid ""
|
|||
|
#| "~~~ # struct Point { x: f64, y: f64 } let point = &@~Point { x: 10f, y: "
|
|||
|
#| "20f }; println(fmt!(\"%f\", point.x)); ~~~"
|
|||
|
msgid ""
|
|||
|
"~~~ # struct Point {x: f64, y: f64} let tmp = Point {x: 3.0, y: 4.0}; let "
|
|||
|
"on_the_stack2 : &Point = &tmp; ~~~"
|
|||
|
msgstr ""
|
|||
|
"~~~\n"
|
|||
|
"# struct Point { x: f64, y: f64 }\n"
|
|||
|
"let point = &@~Point { x: 10f, y: 20f };\n"
|
|||
|
"println(fmt!(\"%f\", point.x));\n"
|
|||
|
"~~~"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:180
|
|||
|
#, fuzzy
|
|||
|
#| msgid "# Borrowed pointers"
|
|||
|
msgid "# Borrowing managed boxes and rooting"
|
|||
|
msgstr "# 借用ポインタ"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:262
|
|||
|
#, fuzzy
|
|||
|
#| msgid "# Borrowed pointers"
|
|||
|
msgid "# Borrowing owned boxes"
|
|||
|
msgstr "# 借用ポインタ"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:367
|
|||
|
#, fuzzy
|
|||
|
#| msgid "# Borrowed pointers"
|
|||
|
msgid "# Borrowing and enums"
|
|||
|
msgstr "# 借用ポインタ"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:477
|
|||
|
#, fuzzy
|
|||
|
#| msgid "# Dereferencing pointers"
|
|||
|
msgid "# Returning references"
|
|||
|
msgstr "# ポインタのデリファレンス"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:490
|
|||
|
#, fuzzy
|
|||
|
#| msgid ""
|
|||
|
#| "~~~ # struct Point { x: f64, y: f64 } let point = &@~Point { x: 10f, y: "
|
|||
|
#| "20f }; println(fmt!(\"%f\", point.x)); ~~~"
|
|||
|
msgid ""
|
|||
|
"~~~ struct Point {x: f64, y: f64} fn get_x<'r>(p: &'r Point) -> &'r f64 { &p."
|
|||
|
"x } ~~~"
|
|||
|
msgstr ""
|
|||
|
"~~~\n"
|
|||
|
"# struct Point { x: f64, y: f64 }\n"
|
|||
|
"let point = &@~Point { x: 10f, y: 20f };\n"
|
|||
|
"println(fmt!(\"%f\", point.x));\n"
|
|||
|
"~~~"
|
|||
|
|
|||
|
#. type: Plain text
|
|||
|
#: doc/guide-lifetimes.md:659
|
|||
|
#, fuzzy
|
|||
|
#| msgid "## Conventions"
|
|||
|
msgid "# Conclusion"
|
|||
|
msgstr "## 本書の表記について"
|