Skip to content

Commit 1f35be4

Browse files
committed
---
yaml --- r: 36677 b: refs/heads/try2 c: 213773c h: refs/heads/master i: 36675: c4b6e3d v: v3
1 parent 9a95935 commit 1f35be4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 4ec658eb694f40c429eb69d07dce541e9b877667
8+
refs/heads/try2: 213773ccb2b33c988366ab93993ad31e5c88b32e
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try2/doc/tutorial-tasks.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ come in a variety of forms, each one appropriate for a different use case. In
150150
what follows, we cover the most commonly used varieties.
151151

152152
The simplest way to create a pipe is to use the `pipes::stream`
153-
function to create a `(Chan, Port)` pair. In Rust parlance, a *channel*
153+
function to create a `(Port, Chan)` pair. In Rust parlance, a *channel*
154154
is a sending endpoint of a pipe, and a *port* is the receiving
155155
endpoint. Consider the following example of calculating two results
156156
concurrently:
@@ -159,7 +159,7 @@ concurrently:
159159
use task::spawn;
160160
use pipes::{stream, Port, Chan};
161161
162-
let (chan, port): (Chan<int>, Port<int>) = stream();
162+
let (port, chan): (Port<int>, Chan<int>) = stream();
163163
164164
do spawn |move chan| {
165165
let result = some_expensive_computation();
@@ -179,7 +179,7 @@ a tuple into its component parts).
179179

180180
~~~~
181181
# use pipes::{stream, Chan, Port};
182-
let (chan, port): (Chan<int>, Port<int>) = stream();
182+
let (port, chan): (Port<int>, Chan<int>) = stream();
183183
~~~~
184184

185185
The child task will use the channel to send data to the parent task,
@@ -191,7 +191,7 @@ spawns the child task.
191191
# use task::spawn;
192192
# use pipes::{stream, Port, Chan};
193193
# fn some_expensive_computation() -> int { 42 }
194-
# let (chan, port) = stream();
194+
# let (port, chan) = stream();
195195
do spawn |move chan| {
196196
let result = some_expensive_computation();
197197
chan.send(result);
@@ -211,7 +211,7 @@ port:
211211
~~~~
212212
# use pipes::{stream, Port, Chan};
213213
# fn some_other_expensive_computation() {}
214-
# let (chan, port) = stream::<int>();
214+
# let (port, chan) = stream::<int>();
215215
# chan.send(0);
216216
some_other_expensive_computation();
217217
let result = port.recv();
@@ -227,7 +227,7 @@ following program is ill-typed:
227227
# use task::{spawn};
228228
# use pipes::{stream, Port, Chan};
229229
# fn some_expensive_computation() -> int { 42 }
230-
let (chan, port) = stream();
230+
let (port, chan) = stream();
231231
232232
do spawn |move chan| {
233233
chan.send(some_expensive_computation());
@@ -247,7 +247,7 @@ Instead we can use a `SharedChan`, a type that allows a single
247247
# use task::spawn;
248248
use pipes::{stream, SharedChan};
249249
250-
let (chan, port) = stream();
250+
let (port, chan) = stream();
251251
let chan = SharedChan(move chan);
252252
253253
for uint::range(0, 3) |init_val| {
@@ -282,7 +282,7 @@ might look like the example below.
282282
283283
// Create a vector of ports, one for each child task
284284
let ports = do vec::from_fn(3) |init_val| {
285-
let (chan, port) = stream();
285+
let (port, chan) = stream();
286286
do spawn |move chan| {
287287
chan.send(some_expensive_computation(init_val));
288288
}
@@ -397,7 +397,7 @@ before returning. Hence:
397397
# use task::{spawn, try};
398398
# fn sleep_forever() { loop { task::yield() } }
399399
# do task::try {
400-
let (sender, receiver): (Chan<int>, Port<int>) = stream();
400+
let (receiver, sender): (Port<int>, Chan<int>) = stream();
401401
do spawn |move receiver| { // Bidirectionally linked
402402
// Wait for the supervised child task to exist.
403403
let message = receiver.recv();

0 commit comments

Comments
 (0)