Skip to content

Commit 05f17f0

Browse files
Ch. 17: minor typos and link reference (#4286)
Co-authored-by: Chris Krycho <[email protected]>
1 parent d3e8ac3 commit 05f17f0

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/ch17-01-futures-and-syntax.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Notice that Rust’s `await` keyword goes _after_ the expression you’re awaiti
131131
not before it. That is, it’s a _postfix_ keyword. This may differ from what
132132
you’re used to if you’ve used `async` in other languages, but in Rust it makes
133133
chains of methods much nicer to work with. As a result, we can change the body
134-
of `page_url_for` to chain the `trpl::get` and `text` function calls together
134+
of `page_title` to chain the `trpl::get` and `text` function calls together
135135
with `await` between them, as shown in Listing 17-2.
136136

137137
<Listing number="17-2" file-name="src/main.rs" caption="Chaining with the `await` keyword">
@@ -319,7 +319,7 @@ function in `main` to set up a runtime and run the future returned by the
319319

320320
> Note: Some runtimes provide macros so you _can_ write an async `main`
321321
> function. Those macros rewrite `async fn main() { ... }` to be a normal `fn
322-
> main`, which does the same thing we did by hand in Listing 17-5: call a
322+
> main`, which does the same thing we did by hand in Listing 17-4: call a
323323
> function that runs a future to completion the way `trpl::run` does.
324324
325325
Now let’s put these pieces together and see how we can write concurrent code.
@@ -364,10 +364,11 @@ enum Either<A, B> {
364364
}
365365
```
366366

367-
The `race` function returns `Left` with that future’s output if the first
368-
argument wins, and `Right` with the second future argument’s output if _that_
369-
one wins. This matches the order the arguments appear in when calling the
370-
function: the first argument is to the left of the second argument.
367+
The `race` function returns `Left` with the output from the first future
368+
argument it finishes first, or `Right` with the output of the second future
369+
argument if that one finishes first. This matches the order the arguments appear
370+
in when calling the function: the first argument is to the left of the second
371+
argument.
371372

372373
We also update `page_title` to return the same URL passed in. That way, if
373374
the page that returns first does not have a `<title>` we can resolve, we can

src/ch17-02-concurrency-with-async.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ flow—exactly what we’re trying _not_ to do.
308308
With the updated code in Listing 17-11, the messages get printed at
309309
500-millisecond intervals, rather than all in a rush after 2 seconds.
310310

311-
The program still never exits, though, because of the way `while let` loop
311+
The program still never exits, though, because of the way the `while let` loop
312312
interacts with `trpl::join`:
313313

314314
- The future returned from `trpl::join` completes only once _both_ futures

src/ch17-03-more-futures.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ join on _all_ of them. The `trpl::join_all` function accepts any type that
2727
implements the `Iterator` trait, which you learned about back in [The Iterator
2828
Trait and the `next` Method][iterator-trait]<!-- ignore --> Chapter 13, so
2929
it seems like just the ticket. Let’s try putting our futures in a vector and
30-
replacing `join!` with `join_all` as show in Listing 17-15.
30+
replacing `join!` with `join_all` as shown in Listing 17-15.
3131

3232
<Listing number="17-15" caption="Storing anonymous futures in a vector and calling `join_all`">
3333

@@ -592,6 +592,6 @@ to consider first, though:
592592
with any collection of futures.)
593593

594594
[dyn]: ch12-03-improving-error-handling-and-modularity.html
595-
[enum-alt]: ch12-03-improving-error-handling-and-modularity.html#returning-errors-from-the-run-function
595+
[enum-alt]: ch08-01-vectors.html#using-an-enum-to-store-multiple-types
596596
[async-program]: ch17-01-futures-and-syntax.html#our-first-async-program
597597
[iterator-trait]: ch13-02-iterators.html#the-iterator-trait-and-the-next-method

0 commit comments

Comments
 (0)