1 # Japanese translations for Rust package
2 # Copyright (C) 2014 The Rust Project Developers
3 # This file is distributed under the same license as the Rust package.
4 # Automatically generated, 2014.
8 "Project-Id-Version: Rust 0.10\n"
9 "POT-Creation-Date: 2014-02-03 08:13+0900\n"
10 "PO-Revision-Date: 2014-01-13 12:01+0900\n"
11 "Last-Translator: Automatically generated\n"
12 "Language-Team: none\n"
15 "Content-Type: text/plain; charset=UTF-8\n"
16 "Content-Transfer-Encoding: 8bit\n"
17 "Plural-Forms: nplurals=1; plural=0;\n"
20 #: src/doc/guide-conditions.md:4 src/doc/guide-ffi.md:4
21 #: src/doc/guide-lifetimes.md:4 src/doc/guide-macros.md:4
22 #: src/doc/guide-tasks.md:4 src/doc/rust.md:4 src/doc/tutorial.md:4
23 msgid "# Introduction"
27 #: src/doc/guide-lifetimes.md:2
29 #| msgid "% The Rust Language Tutorial"
30 msgid "% The Rust References and Lifetimes Guide"
31 msgstr "% Rust 言語チュートリアル"
34 #: src/doc/guide-lifetimes.md:26
36 #| msgid "## A minimal example"
41 #: src/doc/guide-lifetimes.md:33
43 #| msgid "As an example, consider a simple struct type, `Point`:"
44 msgid "As an example, consider a simple struct type `Point`:"
45 msgstr "例として、シンプルな構造体型の `Point` について考えます。"
48 #: src/doc/guide-lifetimes.md:37
51 #| "~~~ # struct Point { x: f64, y: f64 } let point = &@~Point { x: 10f, y: "
52 #| "20f }; println(fmt!(\"%f\", point.x)); ~~~"
53 msgid "~~~ struct Point {x: f64, y: f64} ~~~"
56 "# struct Point { x: f64, y: f64 }\n"
57 "let point = &@~Point { x: 10f, y: 20f };\n"
58 "println(fmt!(\"%f\", point.x));\n"
62 #: src/doc/guide-lifetimes.md:41
65 #| "We can use this simple definition to allocate points in many different "
66 #| "ways. For example, in this code, each of these three local variables "
67 #| "contains a point, but allocated in a different location:"
69 "We can use this simple definition to allocate points in many different ways. "
70 "For example, in this code, each of these three local variables contains a "
71 "point, but allocated in a different place:"
73 "シンプルな定義ですが、この定義を使って `Point` 型のオブジェクトを様々な方法で"
74 "割り当てることができます。例えば、このコードの3つのローカル変数は、それぞれ異"
75 "なった場所に `Point` 型のオブジェクトを割り当てています。"
78 #: src/doc/guide-lifetimes.md:48
80 #| msgid "~~~~ {.ignore} # 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 };"
83 "# struct Point {x: f64, y: f64}\n"
84 "let on_the_stack : Point = Point {x: 3.0, y: 4.0};\n"
85 "let managed_box : @Point = @Point {x: 5.0, y: 1.0};\n"
86 "let owned_box : ~Point = ~Point {x: 7.0, y: 9.0};\n"
90 "# struct Point { x: f64, y: f64 }\n"
91 "let mut mypoint = Point { x: 1.0, y: 1.0 };\n"
92 "let origin = Point { x: 0.0, y: 0.0 };"
95 #: src/doc/guide-lifetimes.md:60
98 #| "Suppose we want to write a procedure that computes the distance between "
99 #| "any two points, no matter where they are stored. For example, we might "
100 #| "like to compute the distance between `on_the_stack` and `managed_box`, or "
101 #| "between `managed_box` and `owned_box`. One option is to define a function "
102 #| "that takes two arguments of type point—that is, it takes the points by "
103 #| "value. But this will cause the points to be copied when we call the "
104 #| "function. For points, this is probably not so bad, but often copies are "
105 #| "expensive. So we’d like to define a function that takes the points by "
106 #| "pointer. We can use borrowed pointers to do this:"
108 "Suppose we wanted to write a procedure that computed the distance between "
109 "any two points, no matter where they were stored. For example, we might like "
110 "to compute the distance between `on_the_stack` and `managed_box`, or between "
111 "`managed_box` and `owned_box`. One option is to define a function that takes "
112 "two arguments of type `Point`—that is, it takes the points by value. But if "
113 "we define it this way, calling the function will cause the points to be "
114 "copied. For points, this is probably not so bad, but often copies are "
115 "expensive. Worse, if the data type contains mutable fields, copying can "
116 "change the semantics of your program in unexpected ways. So we'd like to "
117 "define a function that takes the points by pointer. We can use references to "
120 "`Point` 型のオブジェクトの割り当て先がどこであったとしても利用可能な、任意の "
121 "2 点間の距離を計算する処理を書きたいとします。例えば、 `on_the_stack`, "
122 "`managed_box` 間や `managed_box`, `owned_box` 間の距離を計算する処理です。 1"
123 "つ目の実装方法として、2つの `Point` 型オブジェクトを引数にとる関数を定義する"
124 "方法、すなわち、オブジェクトを値で受け渡す方法があります。しかし、この方法で"
125 "は関数呼び出し時に `Point` オブジェクトのコピーが行われます。`Point` オブジェ"
126 "クトの場合、このような実装はそれほど悪いものではないでしょうが、コピー処理の"
127 "コストは高い場合もあります。したがって、`Point` オブジェクトをポインタ渡しす"
128 "る関数を定義する必要があります。そのために、借用ポインタを利用することが可能"
132 #: src/doc/guide-lifetimes.md:72 src/doc/tutorial.md:1409
133 msgid "Now we can call `compute_distance()` in various ways:"
135 "上記の `compute_distance()` 関数は、様々な方法で呼び出すことができます。"
138 #: src/doc/guide-lifetimes.md:82
140 #| msgid "~~~~ {.ignore} # 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 };"
143 "# struct Point {x: f64, y: f64}\n"
144 "# let on_the_stack : Point = Point{x: 3.0, y: 4.0};\n"
145 "# let managed_box : @Point = @Point{x: 5.0, y: 1.0};\n"
146 "# let owned_box : ~Point = ~Point{x: 7.0, y: 9.0};\n"
147 "# fn compute_distance(p1: &Point, p2: &Point) -> f64 { 0.0 }\n"
148 "compute_distance(&on_the_stack, managed_box);\n"
149 "compute_distance(managed_box, owned_box);\n"
153 "# struct Point { x: f64, y: f64 }\n"
154 "let mut mypoint = Point { x: 1.0, y: 1.0 };\n"
155 "let origin = Point { x: 0.0, y: 0.0 };"
158 #: src/doc/guide-lifetimes.md:89
161 #| "Here the `&` operator is used to take the address of the variable "
162 #| "`on_the_stack`; this is because `on_the_stack` has the type `Point` (that "
163 #| "is, a struct value) and we have to take its address to get a value. We "
164 #| "also call this _borrowing_ the local variable `on_the_stack`, because we "
165 #| "are creating an alias: that is, another route to the same data."
167 "Here, the `&` operator takes the address of the variable `on_the_stack`; "
168 "this is because `on_the_stack` has the type `Point` (that is, a struct "
169 "value) and we have to take its address to get a value. We also call this "
170 "_borrowing_ the local variable `on_the_stack`, because we have created an "
171 "alias: that is, another name for the same data."
173 "ここで `&` 演算子は `on_the_stack` 変数のアドレスを取得するために使われていま"
174 "す。これは、 `on_the_stack` の型は `Point` (つまり、構造体の値) であり、呼び"
175 "出した関数から値を取得させるため、構造体のアドレスを渡す必要があるからです。"
176 "値の別名 (エイリアス)、すなわち、同じデータへアクセスするための別の方法を提供"
177 "するので、このような操作のことをローカル変数 `on_the_stack` の __借用__ "
178 "(_borrowing_) と呼びます。"
181 #: src/doc/guide-lifetimes.md:95
184 #| "In the case of the boxes `managed_box` and `owned_box`, however, no "
185 #| "explicit action is necessary. The compiler will automatically convert a "
186 #| "box like `@point` or `~point` to a borrowed pointer like `&point`. This "
187 #| "is another form of borrowing; in this case, the contents of the managed/"
188 #| "owned box are being lent out."
190 "In contrast, we can pass the boxes `managed_box` and `owned_box` to "
191 "`compute_distance` directly. The compiler automatically converts a box like "
192 "`@Point` or `~Point` to a reference like `&Point`. This is another form of "
193 "borrowing: in this case, the caller lends the contents of the managed or "
194 "owned box to the callee."
196 "ボックスである `managed_box` と `owned_box` の場合は、特に明示的な操作を行う"
197 "必要はありません。コンパイラは `@point` や `~point` のようなボックスを自動的"
198 "に `&point` のような借用ポインタへと変換します。これは、別の形態の借用 "
199 "(borrowing) です。この場合、マネージド/所有ボックスの内容が貸し出されていま"
203 #: src/doc/guide-lifetimes.md:105
206 #| "Whenever a value is borrowed, there are some limitations on what you can "
207 #| "do with the original. For example, if the contents of a variable have "
208 #| "been lent out, you cannot send that variable to another task, nor will "
209 #| "you be permitted to take actions that might cause the borrowed value to "
210 #| "be freed or to change its type. This rule should make intuitive sense: "
211 #| "you must wait for a borrowed value to be returned (that is, for the "
212 #| "borrowed pointer to go out of scope) before you can make full use of it "
215 "Whenever a caller lends data to a callee, there are some limitations on what "
216 "the caller can do with the original. For example, if the contents of a "
217 "variable have been lent out, you cannot send that variable to another task. "
218 "In addition, the compiler will reject any code that might cause the borrowed "
219 "value to be freed or overwrite its component fields with values of different "
220 "types (I'll get into what kinds of actions those are shortly). This rule "
221 "should make intuitive sense: you must wait for a borrower to return the "
222 "value that you lent it (that is, wait for the reference to go out of scope) "
223 "before you can make full use of it again."
225 "値が借用されている間、借用元の値に対して行える操作がいくらか制限されます。例"
226 "えば、変数の内容が貸し出された場合、その変数を他のタスクに送信することはでき"
227 "ませんし、借用された値を解放したり、型が変化させるような操作も行うことができ"
228 "ません。このルールは理にかなったものでしょう。貸し出した値を最大限に活用する "
229 "(make full use of it) ためには、貸し出した値の返却 (借用ポインタが存在するス"
230 "コープを抜ける) を待たなければなりません。"
233 #: src/doc/guide-lifetimes.md:114
236 #| "~~~ # struct Point { x: f64, y: f64 } let point = &@~Point { x: 10f, y: "
237 #| "20f }; println(fmt!(\"%f\", point.x)); ~~~"
239 "~~~ # struct Point {x: f64, y: f64} let on_the_stack: Point = Point {x: 3.0, "
243 "# struct Point { x: f64, y: f64 }\n"
244 "let point = &@~Point { x: 10f, y: 20f };\n"
245 "println(fmt!(\"%f\", point.x));\n"
249 #: src/doc/guide-lifetimes.md:124
252 #| "~~~ # struct Point { x: f64, y: f64 } let point = &@~Point { x: 10f, y: "
253 #| "20f }; println(fmt!(\"%f\", point.x)); ~~~"
255 "~~~ # struct Point {x: f64, y: f64} let on_the_stack2: &Point = &Point {x: "
259 "# struct Point { x: f64, y: f64 }\n"
260 "let point = &@~Point { x: 10f, y: 20f };\n"
261 "println(fmt!(\"%f\", point.x));\n"
265 #: src/doc/guide-lifetimes.md:134
268 #| "~~~ # struct Point { x: f64, y: f64 } let point = &@~Point { x: 10f, y: "
269 #| "20f }; println(fmt!(\"%f\", point.x)); ~~~"
271 "~~~ # struct Point {x: f64, y: f64} let tmp = Point {x: 3.0, y: 4.0}; let "
272 "on_the_stack2 : &Point = &tmp; ~~~"
275 "# struct Point { x: f64, y: f64 }\n"
276 "let point = &@~Point { x: 10f, y: 20f };\n"
277 "println(fmt!(\"%f\", point.x));\n"
281 #: src/doc/guide-lifetimes.md:180
283 #| msgid "# Borrowed pointers"
284 msgid "# Borrowing managed boxes and rooting"
288 #: src/doc/guide-lifetimes.md:262
290 #| msgid "# Borrowed pointers"
291 msgid "# Borrowing owned boxes"
295 #: src/doc/guide-lifetimes.md:367
297 #| msgid "# Borrowed pointers"
298 msgid "# Borrowing and enums"
302 #: src/doc/guide-lifetimes.md:477
304 #| msgid "# Dereferencing pointers"
305 msgid "# Returning references"
306 msgstr "# ポインタのデリファレンス"
309 #: src/doc/guide-lifetimes.md:490
312 #| "~~~ # struct Point { x: f64, y: f64 } let point = &@~Point { x: 10f, y: "
313 #| "20f }; println(fmt!(\"%f\", point.x)); ~~~"
315 "~~~ struct Point {x: f64, y: f64} fn get_x<'r>(p: &'r Point) -> &'r f64 { &p."
319 "# struct Point { x: f64, y: f64 }\n"
320 "let point = &@~Point { x: 10f, y: 20f };\n"
321 "println(fmt!(\"%f\", point.x));\n"
325 #: src/doc/guide-lifetimes.md:533
327 #| msgid "~~~ # struct Point { x: f64, y: f64 } let point = &@~Point { x: 10f, y: 20f }; println(fmt!(\"%f\", point.x)); ~~~"
330 "struct Point {x: f64, y: f64}\n"
331 "fn get_x_sh(p: @Point) -> &f64 {\n"
332 " &p.x // Error reported here\n"
337 "# struct Point { x: f64, y: f64 }\n"
338 "let point = &@~Point { x: 10f, y: 20f };\n"
339 "println(fmt!(\"%f\", point.x));\n"
343 #: src/doc/guide-lifetimes.md:659
345 #| msgid "## Conventions"
347 msgstr "## 本書の表記について"