doc: Update .pot files

This commit is contained in:
gifnksm 2013-07-30 07:08:54 +09:00
parent 7b1b7f3210
commit 2bc8a9be77
8 changed files with 1844 additions and 1779 deletions

File diff suppressed because it is too large Load Diff

View File

@ -7,13 +7,13 @@
msgid ""
msgstr ""
"Project-Id-Version: Rust 0.8-pre\n"
"POT-Creation-Date: 2013-07-17 07:18+0900\n"
"POT-Creation-Date: 2013-07-30 07:07+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. type: Plain text
@ -160,7 +160,7 @@ msgid "# Package identifiers"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:79
#: doc/rustpkg.md:87
msgid ""
"A package identifier identifies a package uniquely. A package can be stored "
"in a workspace on the local file system, or on a remote Web server, in which "
@ -169,51 +169,59 @@ msgid ""
"github.com/mozilla/rust`. A package ID can also specify a version, like: "
"`github.com/mozilla/rust#0.3`. In this case, `rustpkg` will check that the "
"repository `github.com/mozilla/rust` has a tag named `0.3`, and report an "
"error otherwise."
"error otherwise. A package ID can also specify a particular revision of a "
"repository, like: `github.com/mozilla/rust#release-0.7`. When the refspec "
"(portion of the package ID after the `#`) can't be parsed as a decimal "
"number, rustpkg passes the refspec along to the version control system "
"without interpreting it. rustpkg also interprets any dependencies on such a "
"package ID literally (as opposed to versions, where a newer version "
"satisfies a dependency on an older version). Thus, `github.com/mozilla/"
"rust#5c4cd30f80` is also a valid package ID, since git can deduce that "
"5c4cd30f80 refers to a revision of the desired repository."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:81
#: doc/rustpkg.md:89
msgid "## Source files"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:83
#: doc/rustpkg.md:91
msgid ""
"rustpkg searches for four different fixed filenames in order to determine "
"the crates to build:"
msgstr ""
#. type: Bullet: '* '
#: doc/rustpkg.md:88
#: doc/rustpkg.md:96
msgid "`main.rs`: Assumed to be a main entry point for building an executable."
msgstr ""
#. type: Bullet: '* '
#: doc/rustpkg.md:88
#: doc/rustpkg.md:96
msgid "`lib.rs`: Assumed to be a library crate."
msgstr ""
#. type: Bullet: '* '
#: doc/rustpkg.md:88
#: doc/rustpkg.md:96
msgid ""
"`test.rs`: Assumed to contain tests declared with the `#[test]` attribute."
msgstr ""
#. type: Bullet: '* '
#: doc/rustpkg.md:88
#: doc/rustpkg.md:96
msgid ""
"`bench.rs`: Assumed to contain benchmarks declared with the `#[bench]` "
"attribute."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:90
#: doc/rustpkg.md:98
msgid "## Versions"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:97
#: doc/rustpkg.md:105
msgid ""
"`rustpkg` packages do not need to declare their versions with an attribute "
"inside one of the source files, because `rustpkg` infers it from the version "
@ -224,12 +232,12 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:99
#: doc/rustpkg.md:107
msgid "# Dependencies"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:103
#: doc/rustpkg.md:111
msgid ""
"rustpkg infers dependencies from `extern mod` directives. Thus, there "
"should be no need to pass a `-L` flag to rustpkg to tell it where to find a "
@ -238,12 +246,12 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:105
#: doc/rustpkg.md:113
msgid "# Custom build scripts"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:109
#: doc/rustpkg.md:117
msgid ""
"A file called `pkg.rs` at the root level in a workspace is called a *package "
"script*. If a package script exists, rustpkg executes it to build the "
@ -251,7 +259,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:113
#: doc/rustpkg.md:121
msgid ""
"Inside `pkg.rs`, it's possible to call back into rustpkg to finish up the "
"build. `rustpkg::api` contains functions to build, install, or clean "
@ -260,17 +268,17 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:115
#: doc/rustpkg.md:123
msgid "# Command reference"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:117
#: doc/rustpkg.md:125
msgid "## build"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:123
#: doc/rustpkg.md:131
msgid ""
"`rustpkg build foo` searches for a package with ID `foo` and builds it in "
"any workspace(s) where it finds one. Supposing such packages are found in "
@ -279,22 +287,22 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:125
#: doc/rustpkg.md:133
msgid "## clean"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:127
#: doc/rustpkg.md:135
msgid "`rustpkg clean foo` deletes the contents of `foo`'s `build` directory."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:129
#: doc/rustpkg.md:137
msgid "## install"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:133
#: doc/rustpkg.md:141
msgid ""
"`rustpkg install foo` builds the libraries and/or executables that are "
"targets for `foo`, and then installs them either into `foo`'s `lib` and "
@ -303,12 +311,12 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:135
#: doc/rustpkg.md:143
msgid "## test"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:137
#: doc/rustpkg.md:145
msgid ""
"`rustpkg test foo` builds `foo`'s `test.rs` file if necessary, then runs the "
"resulting test executable."

View File

@ -7,13 +7,13 @@
msgid ""
msgstr ""
"Project-Id-Version: Rust 0.8-pre\n"
"POT-Creation-Date: 2013-07-17 07:18+0900\n"
"POT-Creation-Date: 2013-07-22 23:37+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. type: Plain text
@ -24,7 +24,7 @@ msgid "# Introduction"
msgstr ""
#. type: Plain text
#: doc/tutorial.md:1111 doc/tutorial-borrowed-ptr.md:72
#: doc/tutorial.md:1108 doc/tutorial-borrowed-ptr.md:72
msgid "Now we can call `compute_distance()` in various ways:"
msgstr ""
@ -60,8 +60,8 @@ msgstr ""
msgid ""
"Although borrowed pointers have rather elaborate theoretical underpinnings "
"(region pointers), the core concepts will be familiar to anyone who has "
"worked with C or C++. Therefore, the best way to explain how they are "
"usedand their limitationsis probably just to work through several examples."
"worked with C or C++. Therefore, the best way to explain how they are used—"
"and their limitationsis probably just to work through several examples."
msgstr ""
#. type: Plain text
@ -115,7 +115,7 @@ msgid ""
"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 "
"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 "
@ -313,8 +313,8 @@ msgstr ""
#. type: Plain text
#: doc/tutorial-borrowed-ptr.md:186
msgid ""
"Weve seen a few examples so far of borrowing heap boxes, both managed and "
"owned. Up till this point, weve glossed over issues of safety. As stated in "
"Weve seen a few examples so far of borrowing heap boxes, both managed and "
"owned. Up till this point, weve glossed over issues of safety. As stated in "
"the introduction, at runtime a borrowed pointer is simply a pointer, nothing "
"more. Therefore, avoiding C's problems with dangling pointers requires a "
"compile-time safety check."
@ -626,7 +626,7 @@ msgstr ""
#. type: Plain text
#: doc/tutorial-borrowed-ptr.md:376
msgid ""
"As an example, lets look at the following `shape` type that can represent "
"As an example, lets look at the following `shape` type that can represent "
"both rectangles and circles:"
msgstr ""
@ -792,7 +792,7 @@ msgstr ""
#: doc/tutorial-borrowed-ptr.md:483
msgid ""
"So far, all of the examples we have looked at, use borrowed pointers in a "
"downward direction. That is, a method or code block creates a borrowed "
"downward direction. That is, a method or code block creates a borrowed "
"pointer, then uses it within the same scope. It is also possible to return "
"borrowed pointers as the result of a function, but as we'll see, doing so "
"requires some explicit annotation."
@ -844,7 +844,7 @@ msgstr ""
msgid ""
"Named lifetimes that appear in function signatures are conceptually the same "
"as the other lifetimes we have seen before, but they are a bit abstract: "
"they dont refer to a specific expression within `get_x()`, but rather to "
"they dont refer to a specific expression within `get_x()`, but rather to "
"some expression within the *caller of `get_x()`*. The lifetime `r` is "
"actually a kind of *lifetime parameter*: it is defined by the caller to "
"`get_x()`, just as the value for the parameter `p` is defined by that caller."
@ -862,7 +862,7 @@ msgstr ""
#. type: Plain text
#: doc/tutorial-borrowed-ptr.md:526
msgid ""
"To emphasize this point, lets look at a variation on the example, this time "
"To emphasize this point, lets look at a variation on the example, this time "
"one that does not compile:"
msgstr ""

View File

@ -7,13 +7,13 @@
msgid ""
msgstr ""
"Project-Id-Version: Rust 0.8-pre\n"
"POT-Creation-Date: 2013-07-17 07:18+0900\n"
"POT-Creation-Date: 2013-08-05 19:40+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. type: Plain text
@ -242,40 +242,41 @@ msgstr ""
#: doc/tutorial-container.md:112
msgid ""
"Containers implement iteration over the contained elements by returning an "
"iterator object. For example, vector slices have four iterators available:"
"iterator object. For example, vector slices several iterators available:"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-container.md:117
msgid "`vector.iter()`, for immutable references to the elements"
#: doc/tutorial-container.md:116
msgid "`iter()` and `rev_iter()`, for immutable references to the elements"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-container.md:117
msgid "`vector.mut_iter()`, for mutable references to the elements"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-container.md:117
#: doc/tutorial-container.md:116
msgid ""
"`vector.rev_iter()`, for immutable references to the elements in reverse "
"order"
"`mut_iter()` and `mut_rev_iter()`, for mutable references to the elements"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-container.md:117
#: doc/tutorial-container.md:116
msgid ""
"`vector.mut_rev_iter()`, for mutable references to the elements in reverse "
"order"
"`consume_iter()` and `consume_rev_iter`, to move the elements out by-value"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:119
msgid ""
"A typical mutable container will implement at least `iter()`, `mut_iter()` "
"and `consume_iter()` along with the reverse variants if it maintains an "
"order."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:121
msgid "### Freezing"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:123
#: doc/tutorial-container.md:125
msgid ""
"Unlike most other languages with external iterators, Rust has no *iterator "
"invalidation*. As long an iterator is still in scope, the compiler will "
@ -283,7 +284,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:128
#: doc/tutorial-container.md:130
#, no-wrap
msgid ""
"~~~\n"
@ -293,7 +294,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:134
#: doc/tutorial-container.md:136
#, no-wrap
msgid ""
" // the vector is frozen for this scope, the compiler will statically\n"
@ -304,19 +305,19 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:137
#: doc/tutorial-container.md:139
msgid ""
"These semantics are due to most container iterators being implemented with "
"`&` and `&mut`."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:139
#: doc/tutorial-container.md:141
msgid "## Iterator adaptors"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:143
#: doc/tutorial-container.md:145
msgid ""
"The `IteratorUtil` trait implements common algorithms as methods extending "
"every `Iterator` implementation. For example, the `fold` method will "
@ -324,28 +325,28 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:149
#: doc/tutorial-container.md:151
msgid ""
"~~~ let xs = [1, 9, 2, 3, 14, 12]; let result = xs.iter().fold(0, |"
"accumulator, item| accumulator - *item); assert_eq!(result, -41); ~~~"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:151
#: doc/tutorial-container.md:153
msgid ""
"Some adaptors return an adaptor object implementing the `Iterator` trait "
"itself:"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:158
#: doc/tutorial-container.md:160
msgid ""
"~~~ let xs = [1, 9, 2, 3, 14, 12]; let ys = [5, 2, 1, 8]; let sum = xs."
"iter().chain_(ys.iter()).fold(0, |a, b| a + *b); assert_eq!(sum, 57); ~~~"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:162
#: doc/tutorial-container.md:164
msgid ""
"Note that some adaptors like the `chain_` method above use a trailing "
"underscore to work around an issue with method resolve. The underscores will "
@ -353,17 +354,14 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:164
#: doc/tutorial-container.md:166
msgid "## For loops"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:168
msgid ""
"The `for` loop syntax is currently in transition, and will switch from the "
"old closure-based iteration protocol to iterator objects. For now, the "
"`advance` adaptor is required as a compatibility shim to use iterators with "
"for loops."
"The `for` keyword can be used as sugar for iterating through any iterator:"
msgstr ""
#. type: Plain text
@ -419,7 +417,7 @@ msgstr ""
msgid ""
"// print out the pairs of elements up to (&3, &\"baz\")\n"
"for (x, y) in it {\n"
" println(fmt!(\"%d %s\", *x, *y));\n"
" printfln!(\"%d %s\", *x, *y);\n"
msgstr ""
#. type: Plain text
@ -435,8 +433,8 @@ msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:204
msgid ""
"// yield and print the last pair from the iterator println(fmt!(\"last: %?"
"\", it.next()));"
"// yield and print the last pair from the iterator printfln!(\"last: %?\", "
"it.next());"
msgstr ""
#. type: Plain text
@ -577,9 +575,9 @@ msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:300
msgid ""
"~~~ let xs = [1, 2, 3, 4, 5, 6]; let mut it = xs.iter(); println(fmt!(\"%?"
"\", it.next())); // prints `Some(&1)` println(fmt!(\"%?\", it.next())); // "
"prints `Some(&2)` println(fmt!(\"%?\", it.next_back())); // prints `Some(&6)`"
"~~~ let xs = [1, 2, 3, 4, 5, 6]; let mut it = xs.iter(); printfln!(\"%?\", "
"it.next()); // prints `Some(&1)` printfln!(\"%?\", it.next()); // prints "
"`Some(&2)` printfln!(\"%?\", it.next_back()); // prints `Some(&6)`"
msgstr ""
#. type: Plain text
@ -588,14 +586,88 @@ msgstr ""
msgid ""
"// prints `5`, `4` and `3`\n"
"for &x in it.invert() {\n"
" println(fmt!(\"%?\", x))\n"
" printfln!(\"%?\", x)\n"
"}\n"
"~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:308
#: doc/tutorial-container.md:309
msgid ""
"The `rev_iter` and `mut_rev_iter` methods on vectors just return an inverted "
"version of the standard immutable and mutable vector iterators."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:312
msgid ""
"The `chain_`, `transform`, `filter`, `filter_map` and `peek` adaptors are "
"`DoubleEndedIterator` implementations if the underlying iterators are."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:317
msgid ""
"~~~ let xs = [1, 2, 3, 4]; let ys = [5, 6, 7, 8]; let mut it = xs.iter()."
"chain_(ys.iter()).transform(|&x| x * 2);"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:319
msgid "printfln!(\"%?\", it.next()); // prints `Some(2)`"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:325
#, no-wrap
msgid ""
"// prints `16`, `14`, `12`, `10`, `8`, `6`, `4`\n"
"for x in it.invert() {\n"
" printfln!(\"%?\", x);\n"
"}\n"
"~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:327
msgid "## Random-access iterators"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:331
msgid ""
"The `RandomAccessIterator` trait represents an iterator offering random "
"access to the whole range. The `indexable` method retrieves the number of "
"elements accessible with the `idx` method."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:334
msgid ""
"The `chain_` adaptor is an implementation of `RandomAccessIterator` if the "
"underlying iterators are."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:343
msgid ""
"~~~ let xs = [1, 2, 3, 4, 5]; let ys = ~[7, 9, 11]; let mut it = xs.iter()."
"chain_(ys.iter()); printfln!(\"%?\", it.idx(0)); // prints `Some(&1)` "
"printfln!(\"%?\", it.idx(5)); // prints `Some(&7)` printfln!(\"%?\", it."
"idx(7)); // prints `Some(&11)` printfln!(\"%?\", it.idx(8)); // prints `None`"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:348
msgid ""
"// yield two elements from the beginning, and one from the end it.next(); it."
"next(); it.next_back();"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:352
msgid ""
"printfln!(\"%?\", it.idx(0)); // prints `Some(&3)` printfln!(\"%?\", it."
"idx(4)); // prints `Some(&9)` printfln!(\"%?\", it.idx(6)); // prints `None` "
"~~~"
msgstr ""

View File

@ -7,13 +7,13 @@
msgid ""
msgstr ""
"Project-Id-Version: Rust 0.8-pre\n"
"POT-Creation-Date: 2013-07-17 07:18+0900\n"
"POT-Creation-Date: 2013-08-10 07:44+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. type: Plain text
@ -24,7 +24,7 @@ msgid "# Introduction"
msgstr ""
#. type: Plain text
#: doc/tutorial.md:876 doc/tutorial-ffi.md:143
#: doc/tutorial.md:868 doc/tutorial-ffi.md:143
msgid "# Destructors"
msgstr ""
@ -446,11 +446,87 @@ msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:232
msgid "# Accessing foreign globals"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:236
msgid ""
"Foreign APIs often export a global variable which could do something like "
"track global state. In order to access these variables, you declare them in "
"`extern` blocks with the `static` keyword:"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:239
msgid "~~~{.xfail-test} use std::libc;"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:244
#, no-wrap
msgid ""
"#[link_args = \"-lreadline\"]\n"
"extern {\n"
" static rl_readline_version: libc::c_int;\n"
"}\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:250
#, no-wrap
msgid ""
"fn main() {\n"
" println(fmt!(\"You have readline version %d installed.\",\n"
" rl_readline_version as int));\n"
"}\n"
"~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:254
msgid ""
"Alternatively, you may need to alter global state provided by a foreign "
"interface. To do this, statics can be declared with `mut` so rust can mutate "
"them."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:258
msgid "~~~{.xfail-test} use std::libc; use std::ptr;"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:263
#, no-wrap
msgid ""
"#[link_args = \"-lreadline\"]\n"
"extern {\n"
" static mut rl_prompt: *libc::c_char;\n"
"}\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:272
#, no-wrap
msgid ""
"fn main() {\n"
" do \"[my-awesome-shell] $\".as_c_str |buf| {\n"
" unsafe { rl_prompt = buf; }\n"
" // get a line, process it\n"
" unsafe { rl_prompt = ptr::null(); }\n"
" }\n"
"}\n"
"~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:274
msgid "# Foreign calling conventions"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:237
#: doc/tutorial-ffi.md:279
msgid ""
"Most foreign code exposes a C ABI, and Rust uses the platform's C calling "
"convention by default when calling foreign functions. Some foreign "
@ -460,7 +536,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:246
#: doc/tutorial-ffi.md:288
#, no-wrap
msgid ""
"~~~~\n"
@ -474,7 +550,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:250
#: doc/tutorial-ffi.md:292
msgid ""
"The `abi` attribute applies to a foreign module (it cannot be applied to a "
"single function within a module), and must be either `\"cdecl\"` or `"
@ -482,12 +558,12 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:252
#: doc/tutorial-ffi.md:294
msgid "# Interoperability with foreign code"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:256
#: doc/tutorial-ffi.md:298
msgid ""
"Rust guarantees that the layout of a `struct` is compatible with the "
"platform's representation in C. A `#[packed]` attribute is available, which "
@ -496,7 +572,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:263
#: doc/tutorial-ffi.md:305
msgid ""
"Rust's owned and managed boxes use non-nullable pointers as handles which "
"point to the contained object. However, they should not be manually created "
@ -508,7 +584,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:268
#: doc/tutorial-ffi.md:310
msgid ""
"Vectors and strings share the same basic memory layout, and utilities are "
"available in the `vec` and `str` modules for working with C APIs. Strings "
@ -518,7 +594,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:270
#: doc/tutorial-ffi.md:312
msgid ""
"The standard library includes type aliases and function definitions for the "
"C standard library in the `libc` module, and Rust links against `libc` and "

View File

@ -7,13 +7,13 @@
msgid ""
msgstr ""
"Project-Id-Version: Rust 0.8-pre\n"
"POT-Creation-Date: 2013-07-17 07:18+0900\n"
"POT-Creation-Date: 2013-07-22 23:37+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. type: Plain text
@ -24,7 +24,7 @@ msgid "# Introduction"
msgstr ""
#. type: Plain text
#: doc/rust.md:2033 doc/rust.md:2174 doc/tutorial-macros.md:323
#: doc/rust.md:2136 doc/rust.md:2223 doc/tutorial-macros.md:323
msgid "~~~~"
msgstr ""

View File

@ -7,13 +7,13 @@
msgid ""
msgstr ""
"Project-Id-Version: Rust 0.8-pre\n"
"POT-Creation-Date: 2013-07-17 07:18+0900\n"
"POT-Creation-Date: 2013-08-08 22:27+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. type: Plain text
@ -24,7 +24,7 @@ msgid "# Introduction"
msgstr ""
#. type: Plain text
#: doc/rust.md:1849 doc/tutorial-tasks.md:649
#: doc/rust.md:1952 doc/tutorial-tasks.md:648
msgid "# } ~~~~"
msgstr ""
@ -249,15 +249,15 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:124
msgid "~~~ # use std::io::print; # use std::task::spawn; # use std::int;"
#: doc/tutorial-tasks.md:123
msgid "~~~ # use std::io::print; # use std::task::spawn;"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:131
#: doc/tutorial-tasks.md:130
#, no-wrap
msgid ""
"for int::range(0, 20) |child_task_number| {\n"
"for child_task_number in range(0, 20) {\n"
" do spawn {\n"
" print(fmt!(\"I am child number %d\\n\", child_task_number));\n"
" }\n"
@ -266,12 +266,12 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:133
#: doc/tutorial-tasks.md:132
msgid "## Communication"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:138
#: doc/tutorial-tasks.md:137
msgid ""
"Now that we have spawned a new task, it would be nice if we could "
"communicate with it. Recall that Rust does not have shared mutable state, so "
@ -280,7 +280,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:143
#: doc/tutorial-tasks.md:142
msgid ""
"A pipe is simply a pair of endpoints: one for sending messages and another "
"for receiving messages. Pipes are low-level communication building-blocks "
@ -289,7 +289,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:149
#: doc/tutorial-tasks.md:148
msgid ""
"The simplest way to create a pipe is to use the `pipes::stream` function to "
"create a `(Port, Chan)` pair. In Rust parlance, a *channel* is a sending "
@ -298,17 +298,17 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:153
#: doc/tutorial-tasks.md:152
msgid "~~~~ # use std::task::spawn; # use std::comm::{stream, Port, Chan};"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:155
#: doc/tutorial-tasks.md:154
msgid "let (port, chan): (Port<int>, Chan<int>) = stream();"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:160
#: doc/tutorial-tasks.md:159
#, no-wrap
msgid ""
"do spawn || {\n"
@ -318,7 +318,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:166
#: doc/tutorial-tasks.md:165
msgid ""
"some_other_expensive_computation(); let result = port.recv(); # fn "
"some_expensive_computation() -> int { 42 } # fn "
@ -326,7 +326,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:171
#: doc/tutorial-tasks.md:170
msgid ""
"Let's examine this example in detail. First, the `let` statement creates a "
"stream for sending and receiving integers (the left-hand side of the `let`, "
@ -335,14 +335,14 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:176
#: doc/tutorial-tasks.md:175
msgid ""
"~~~~ # use std::comm::{stream, Chan, Port}; let (port, chan): (Port<int>, "
"Chan<int>) = stream(); ~~~~"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:180
#: doc/tutorial-tasks.md:179
msgid ""
"The child task will use the channel to send data to the parent task, which "
"will wait to receive the data on the port. The next statement spawns the "
@ -350,7 +350,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:191
#: doc/tutorial-tasks.md:190
#, no-wrap
msgid ""
"~~~~\n"
@ -366,7 +366,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:197
#: doc/tutorial-tasks.md:196
msgid ""
"Notice that the creation of the task closure transfers `chan` to the child "
"task implicitly: the closure captures `chan` in its environment. Both `Chan` "
@ -376,14 +376,14 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:201
#: doc/tutorial-tasks.md:200
msgid ""
"Finally, the parent continues with some other expensive computation, then "
"waits for the child's result to arrive on the port:"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:210
#: doc/tutorial-tasks.md:209
msgid ""
"~~~~ # use std::comm::{stream}; # fn some_other_expensive_computation() {} # "
"let (port, chan) = stream::<int>(); # chan.send(0); "
@ -391,7 +391,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:216
#: doc/tutorial-tasks.md:215
msgid ""
"The `Port` and `Chan` pair created by `stream` enables efficient "
"communication between a single sender and a single receiver, but multiple "
@ -401,7 +401,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:222
#: doc/tutorial-tasks.md:221
msgid ""
"~~~ {.xfail-test} # use std::task::{spawn}; # use std::comm::{stream, Port, "
"Chan}; # fn some_expensive_computation() -> int { 42 } let (port, chan) = "
@ -409,7 +409,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:226
#: doc/tutorial-tasks.md:225
#, no-wrap
msgid ""
"do spawn {\n"
@ -418,7 +418,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:233
#: doc/tutorial-tasks.md:232
#, no-wrap
msgid ""
"// ERROR! The previous spawn statement already owns the channel,\n"
@ -430,29 +430,27 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:236
#: doc/tutorial-tasks.md:235
msgid ""
"Instead we can use a `SharedChan`, a type that allows a single `Chan` to be "
"shared by multiple senders."
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:241
msgid ""
"~~~ # use std::task::spawn; # use std::comm::{stream, SharedChan}; # use "
"std::uint;"
#: doc/tutorial-tasks.md:239
msgid "~~~ # use std::task::spawn; # use std::comm::{stream, SharedChan};"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:244
#: doc/tutorial-tasks.md:242
msgid "let (port, chan) = stream(); let chan = SharedChan::new(chan);"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:252
#: doc/tutorial-tasks.md:250
#, no-wrap
msgid ""
"for uint::range(0, 3) |init_val| {\n"
"for init_val in range(0u, 3) {\n"
" // Create a new channel handle to distribute to the child task\n"
" let child_chan = chan.clone();\n"
" do spawn {\n"
@ -462,14 +460,14 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:256
#: doc/tutorial-tasks.md:254
msgid ""
"let result = port.recv() + port.recv() + port.recv(); # fn "
"some_expensive_computation(_i: uint) -> int { 42 } ~~~"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:265
#: doc/tutorial-tasks.md:263
msgid ""
"Here we transfer ownership of the channel into a new `SharedChan` value. "
"Like `Chan`, `SharedChan` is a non-copyable, owned type (sometimes also "
@ -482,7 +480,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:270
#: doc/tutorial-tasks.md:268
msgid ""
"Note that the above `SharedChan` example is somewhat contrived since you "
"could also simply use three `stream` pairs, but it serves to illustrate the "
@ -491,12 +489,12 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:275
#: doc/tutorial-tasks.md:273
msgid "~~~ # use std::task::spawn; # use std::comm::stream; # use std::vec;"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:284
#: doc/tutorial-tasks.md:282
#, no-wrap
msgid ""
"// Create a vector of ports, one for each child task\n"
@ -510,7 +508,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:289
#: doc/tutorial-tasks.md:287
msgid ""
"// Wait on each port, accumulating the results let result = ports.iter()."
"fold(0, |accum, port| accum + port.recv() ); # fn "
@ -518,14 +516,14 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:293
#: doc/tutorial-tasks.md:291
msgid ""
"## Backgrounding computations: Futures With `extra::future`, rust has a "
"mechanism for requesting a computation and getting the result later."
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:301
#: doc/tutorial-tasks.md:299
#, no-wrap
msgid ""
"The basic example below illustrates this.\n"
@ -538,14 +536,14 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:306
#: doc/tutorial-tasks.md:304
msgid ""
"let mut delayed_fib = extra::future::spawn (|| fib(50) ); make_a_sandwich(); "
"println(fmt!(\"fib(50) = %?\", delayed_fib.get())) ~~~"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:312
#: doc/tutorial-tasks.md:310
msgid ""
"The call to `future::spawn` returns immediately a `future` object regardless "
"of how long it takes to run `fib(50)`. You can then make yourself a sandwich "
@ -557,17 +555,16 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:325
#: doc/tutorial-tasks.md:322
#, no-wrap
msgid ""
"Here is another example showing how futures allow you to background computations. The workload will\n"
"be distributed on the available cores.\n"
"~~~\n"
"# use std::vec;\n"
"# use std::uint;\n"
"fn partial_sum(start: uint) -> f64 {\n"
" let mut local_sum = 0f64;\n"
" for uint::range(start*100000, (start+1)*100000) |num| {\n"
" for num in range(start*100000, (start+1)*100000) {\n"
" local_sum += (num as f64 + 1.0).pow(&-2.0);\n"
" }\n"
" local_sum\n"
@ -575,7 +572,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:328
#: doc/tutorial-tasks.md:325
#, no-wrap
msgid ""
"fn main() {\n"
@ -583,25 +580,25 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:336
#: doc/tutorial-tasks.md:333
#, no-wrap
msgid ""
" let mut final_res = 0f64;\n"
" for ft in futures.mut_iter() {\n"
" final_res += ft.get();\n"
" }\n"
" println(fmt!(\"^2/6 is not far from : %?\", final_res));\n"
" println(fmt!(\"π^2/6 is not far from : %?\", final_res));\n"
"}\n"
"~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:338
#: doc/tutorial-tasks.md:335
msgid "## Sharing immutable data without copy: Arc"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:343
#: doc/tutorial-tasks.md:340
msgid ""
"To share immutable data between tasks, a first approach would be to only use "
"pipes as we have seen previously. A copy of the data to share would then be "
@ -610,7 +607,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:347
#: doc/tutorial-tasks.md:344
msgid ""
"To tackle this issue, one can use an Atomically Reference Counted wrapper "
"(`Arc`) as implemented in the `extra` library of Rust. With an Arc, the data "
@ -619,16 +616,16 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:355
#: doc/tutorial-tasks.md:351
msgid ""
"Here is a small example showing how to use Arcs. We wish to run concurrently "
"several computations on a single large vector of floats. Each task needs the "
"full vector to perform its duty. ~~~ # use std::vec; # use std::uint; # use "
"std::rand; use extra::arc::Arc;"
"full vector to perform its duty. ~~~ # use std::vec; # use std::rand; use "
"extra::arc::Arc;"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:359
#: doc/tutorial-tasks.md:355
#, no-wrap
msgid ""
"fn pnorm(nums: &~[float], p: uint) -> float {\n"
@ -637,7 +634,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:363
#: doc/tutorial-tasks.md:359
#, no-wrap
msgid ""
"fn main() {\n"
@ -646,22 +643,22 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:365
#: doc/tutorial-tasks.md:361
#, no-wrap
msgid " let numbers_arc = Arc::new(numbers);\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:369
#: doc/tutorial-tasks.md:365
#, no-wrap
msgid ""
" for uint::range(1,10) |num| {\n"
" for num in range(1u, 10) {\n"
" let (port, chan) = stream();\n"
" chan.send(numbers_arc.clone());\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:378
#: doc/tutorial-tasks.md:374
#, no-wrap
msgid ""
" do spawn {\n"
@ -675,45 +672,45 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:400
#: doc/tutorial-tasks.md:396
msgid ""
"The function `pnorm` performs a simple computation on the vector (it "
"computes the sum of its items at the power given as argument and takes the "
"inverse power of this value). The Arc on the vector is created by the line "
"~~~ # use extra::arc::Arc; # use std::vec; # use std::rand; # let numbers = "
"vec::from_fn(1000000, |_| rand::random::<float>()); let "
"numbers_arc=Arc::new(numbers); ~~~ and a clone of it is sent to each task ~~~ # "
"use extra::arc::Arc; # use std::vec; # use std::rand; # let numbers=vec::"
"from_fn(1000000, |_| rand::random::<float>()); # let numbers_arc = "
"Arc::new(numbers); # let (port, chan) = stream(); chan.send(numbers_arc."
"vec::from_fn(1000000, |_| rand::random::<float>()); let numbers_arc=Arc::"
"new(numbers); ~~~ and a clone of it is sent to each task ~~~ # use extra::"
"arc::Arc; # use std::vec; # use std::rand; # let numbers=vec::"
"from_fn(1000000, |_| rand::random::<float>()); # let numbers_arc = Arc::"
"new(numbers); # let (port, chan) = stream(); chan.send(numbers_arc."
"clone()); ~~~ copying only the wrapper and not its contents."
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:414
#: doc/tutorial-tasks.md:410
msgid ""
"Each task recovers the underlying data by ~~~ # use extra::arc::Arc; # use "
"std::vec; # use std::rand; # let numbers=vec::from_fn(1000000, |_| rand::"
"random::<float>()); # let numbers_arc=Arc::new(numbers); # let (port, chan) = "
"stream(); # chan.send(numbers_arc.clone()); # let local_arc : Arc<~[float]> "
"= port.recv(); let task_numbers = local_arc.get(); ~~~ and can use it as if "
"it were local."
"random::<float>()); # let numbers_arc=Arc::new(numbers); # let (port, chan) "
"= stream(); # chan.send(numbers_arc.clone()); # let local_arc : "
"Arc<~[float]> = port.recv(); let task_numbers = local_arc.get(); ~~~ and can "
"use it as if it were local."
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:416
#: doc/tutorial-tasks.md:412
msgid ""
"The `arc` module also implements Arcs around mutable data that are not "
"covered here."
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:418
#: doc/tutorial-tasks.md:414
msgid "# Handling task failure"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:427
#: doc/tutorial-tasks.md:423
msgid ""
"Rust has a built-in mechanism for raising exceptions. The `fail!()` macro "
"(which can also be written with an error string as an argument: `fail!"
@ -726,29 +723,29 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:430
#: doc/tutorial-tasks.md:426
msgid ""
"All tasks are, by default, _linked_ to each other. That means that the fates "
"of all tasks are intertwined: if one fails, so do all the others."
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:438
#: doc/tutorial-tasks.md:434
msgid ""
"~~~ # use std::task::spawn; # use std::task; # fn do_some_work() { loop "
"{ task::yield() } } # do task::try { // Create a child task that fails do "
"spawn { fail!() }"
"~~~{.xfail-test .linked-failure} # use std::task::spawn; # use std::task; # "
"fn do_some_work() { loop { task::yield() } } # do task::try { // Create a "
"child task that fails do spawn { fail!() }"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:443
#: doc/tutorial-tasks.md:439
msgid ""
"// This will also fail because the task we spawned failed do_some_work(); "
"# }; ~~~"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:453
#: doc/tutorial-tasks.md:449
msgid ""
"While it isn't possible for a task to recover from failure, tasks may notify "
"each other of failure. The simplest way of handling task failure is with the "
@ -762,10 +759,10 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:467
#: doc/tutorial-tasks.md:463
#, no-wrap
msgid ""
"~~~\n"
"~~~{.xfail-test .linked-failure}\n"
"# use std::task;\n"
"# fn some_condition() -> bool { false }\n"
"# fn calculate_result() -> int { 0 }\n"
@ -781,7 +778,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:473
#: doc/tutorial-tasks.md:469
msgid ""
"Unlike `spawn`, the function spawned using `try` may return a value, which "
"`try` will dutifully propagate back to the caller in a [`Result`] enum. If "
@ -790,12 +787,12 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:475
#: doc/tutorial-tasks.md:471
msgid "[`Result`]: std/result.html"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:480
#: doc/tutorial-tasks.md:476
msgid ""
"> ***Note:*** A failed task does not currently produce a useful error > "
"value (`try` always returns `Err(())`). In the > future, it may be possible "
@ -803,14 +800,14 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:483
#: doc/tutorial-tasks.md:479
msgid ""
"TODO: Need discussion of `future_result` in order to make failure modes "
"useful."
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:491
#: doc/tutorial-tasks.md:487
msgid ""
"But not all failures are created equal. In some cases you might need to "
"abort the entire program (perhaps you're writing an assert which, if it "
@ -822,24 +819,25 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:493
#: doc/tutorial-tasks.md:489
msgid "## Failure modes"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:496
#: doc/tutorial-tasks.md:492
msgid ""
"By default, task failure is _bidirectionally linked_, which means that if "
"either task fails, it kills the other one."
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:510
#: doc/tutorial-tasks.md:507
#, no-wrap
msgid ""
"~~~\n"
"~~~{.xfail-test .linked-failure}\n"
"# use std::task;\n"
"# fn sleep_forever() { loop { task::yield() } }\n"
"# use std::comm::oneshot;\n"
"# fn sleep_forever() { loop { let (p, c) = oneshot::<()>(); p.recv(); } }\n"
"# do task::try {\n"
"do spawn {\n"
" do spawn {\n"
@ -853,7 +851,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:517
#: doc/tutorial-tasks.md:514
msgid ""
"If you want parent tasks to be able to kill their children, but do not want "
"a parent to fail automatically if one of its child task fails, you can call "
@ -864,14 +862,15 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:538
#: doc/tutorial-tasks.md:536
#, no-wrap
msgid ""
"~~~\n"
"~~~{.xfail-test .linked-failure}\n"
"# use std::comm::{stream, Chan, Port};\n"
"# use std::comm::oneshot;\n"
"# use std::task::{spawn, try};\n"
"# use std::task;\n"
"# fn sleep_forever() { loop { task::yield() } }\n"
"# fn sleep_forever() { loop { let (p, c) = oneshot::<()>(); p.recv(); } }\n"
"# do task::try {\n"
"let (receiver, sender): (Port<int>, Chan<int>) = stream();\n"
"do spawn { // Bidirectionally linked\n"
@ -890,7 +889,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:544
#: doc/tutorial-tasks.md:542
msgid ""
"Supervised failure is useful in any situation where one task manages "
"multiple fallible child tasks, and the parent task can recover if any child "
@ -899,20 +898,21 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:547
#: doc/tutorial-tasks.md:545
msgid ""
"Supervised task failure propagates across multiple generations even if an "
"intermediate generation has already exited:"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:563
#: doc/tutorial-tasks.md:562
#, no-wrap
msgid ""
"~~~\n"
"~~~{.xfail-test .linked-failure}\n"
"# use std::task;\n"
"# fn sleep_forever() { loop { task::yield() } }\n"
"# fn wait_for_a_while() { for 1000.times { task::yield() } }\n"
"# use std::comm::oneshot;\n"
"# fn sleep_forever() { loop { let (p, c) = oneshot::<()>(); p.recv(); } }\n"
"# fn wait_for_a_while() { for _ in range(0, 1000u) { task::yield() } }\n"
"# do task::try::<int> {\n"
"do task::spawn_supervised {\n"
" do task::spawn_supervised {\n"
@ -927,20 +927,20 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:566
#: doc/tutorial-tasks.md:565
msgid ""
"Finally, tasks can be configured to not propagate failure to each other at "
"all, using `task::spawn_unlinked` for _isolated failure_."
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:582
#: doc/tutorial-tasks.md:581
#, no-wrap
msgid ""
"~~~\n"
"~~~{.xfail-test .linked-failure}\n"
"# use std::task;\n"
"# fn random() -> uint { 100 }\n"
"# fn sleep_for(i: uint) { for i.times { task::yield() } }\n"
"# fn sleep_for(i: uint) { for _ in range(0, i) { task::yield() } }\n"
"# do task::try::<()> {\n"
"let (time1, time2) = (random(), random());\n"
"do task::spawn_unlinked {\n"
@ -955,12 +955,12 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:584
#: doc/tutorial-tasks.md:583
msgid "## Creating a task with a bi-directional communication path"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:589
#: doc/tutorial-tasks.md:588
msgid ""
"A very common thing to do is to spawn a child task where the parent and "
"child both need to exchange messages with each other. The function `extra::"
@ -969,7 +969,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:594
#: doc/tutorial-tasks.md:593
msgid ""
"To see how `DuplexStream()` works, we will create a child task that "
"repeatedly receives a `uint` message, converts it to a string, and sends the "
@ -978,10 +978,10 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:607
#: doc/tutorial-tasks.md:606
#, no-wrap
msgid ""
"~~~~\n"
"~~~{.xfail-test .linked-failure}\n"
"# use extra::comm::DuplexStream;\n"
"# use std::uint;\n"
"fn stringifier(channel: &DuplexStream<~str, uint>) {\n"
@ -996,7 +996,7 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:615
#: doc/tutorial-tasks.md:614
msgid ""
"The implementation of `DuplexStream` supports both sending and receiving. "
"The `stringifier` function takes a `DuplexStream` that can send strings (the "
@ -1007,15 +1007,15 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:617
#: doc/tutorial-tasks.md:616
msgid "Here is the code for the parent task:"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:631
#: doc/tutorial-tasks.md:630
#, no-wrap
msgid ""
"~~~~\n"
"~~~{.xfail-test .linked-failure}\n"
"# use std::task::spawn;\n"
"# use std::uint;\n"
"# use extra::comm::DuplexStream;\n"
@ -1031,12 +1031,12 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:633
#: doc/tutorial-tasks.md:632
msgid "let (from_child, to_child) = DuplexStream();"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:637
#: doc/tutorial-tasks.md:636
#, no-wrap
msgid ""
"do spawn {\n"
@ -1045,23 +1045,23 @@ msgid ""
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:640
#: doc/tutorial-tasks.md:639
msgid "from_child.send(22); assert!(from_child.recv() == ~\"22\");"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:643
#: doc/tutorial-tasks.md:642
msgid "from_child.send(23); from_child.send(0);"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:646
#: doc/tutorial-tasks.md:645
msgid ""
"assert!(from_child.recv() == ~\"23\"); assert!(from_child.recv() == ~\"0\");"
msgstr ""
#. type: Plain text
#: doc/tutorial-tasks.md:653
#: doc/tutorial-tasks.md:652
msgid ""
"The parent task first calls `DuplexStream` to create a pair of bidirectional "
"endpoints. It then uses `task::spawn` to create the child task, which "

File diff suppressed because it is too large Load Diff