Skip to content

Commit

Permalink
update original
Browse files Browse the repository at this point in the history
  • Loading branch information
funkill committed Jan 23, 2025
1 parent 7119ae1 commit 1313ee7
Show file tree
Hide file tree
Showing 44 changed files with 64 additions and 54 deletions.
2 changes: 1 addition & 1 deletion rustbook-en/2018-edition/src/ch19-03-advanced-traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The 2018 edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch20-03-advanced-traits.html) instead.
version of the book](../ch20-02-advanced-traits.html) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/2018-edition/src/ch19-04-advanced-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The 2018 edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch20-04-advanced-types.html) instead.
version of the book](../ch20-03-advanced-types.html) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The 2018 edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch20-05-advanced-functions-and-closures.html) instead.
version of the book](../ch20-04-advanced-functions-and-closures.html) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/2018-edition/src/ch19-06-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The 2018 edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch20-06-macros.html) instead.
version of the book](../ch20-05-macros.html) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
Expand Down
12 changes: 8 additions & 4 deletions rustbook-en/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ git-repository-url = "https://github.com/rust-lang/book"
"ch18-03-pattern-syntax.html" = "ch19-03-pattern-syntax.html"
"ch19-00-advanced-features.html" = "ch20-00-advanced-features.html"
"ch19-01-unsafe-rust.html" = "ch20-01-unsafe-rust.html"
"ch19-03-advanced-traits.html" = "ch20-03-advanced-traits.html"
"ch19-04-advanced-types.html" = "ch20-04-advanced-types.html"
"ch19-05-advanced-functions-and-closures.html" = "ch20-05-advanced-functions-and-closures.html"
"ch19-06-macros.html" = "ch20-06-macros.html"
"ch19-03-advanced-traits.html" = "ch20-02-advanced-traits.html"
"ch20-03-advanced-traits.html" = "ch20-02-advanced-traits.html"
"ch19-04-advanced-types.html" = "ch20-03-advanced-types.html"
"ch20-04-advanced-types.html" = "ch20-03-advanced-types.html"
"ch19-05-advanced-functions-and-closures.html" = "ch20-04-advanced-functions-and-closures.html"
"ch20-05-advanced-functions-and-closures.html" = "ch20-04-advanced-functions-and-closures.html"
"ch19-06-macros.html" = "ch20-05-macros.html"
"ch20-06-macros.html" = "ch20-05-macros.html"
"ch20-00-final-project-a-web-server.html" = "ch21-00-final-project-a-web-server.html"
"ch20-01-single-threaded.html" = "ch21-01-single-threaded.html"
"ch20-02-multithreaded.html" = "ch21-02-multithreaded.html"
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/first-edition/src/associated-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The first edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch20-03-advanced-traits.html#specifying-placeholder-types-in-trait-definitions-with-associated-types) instead.
version of the book](../ch20-02-advanced-traits.html#specifying-placeholder-types-in-trait-definitions-with-associated-types) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/first-edition/src/macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The first edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch20-06-macros.html) instead.
version of the book](../ch20-05-macros.html) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/first-edition/src/operators-and-overloading.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The first edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch20-03-advanced-traits.html#default-generic-type-parameters-and-operator-overloading) instead.
version of the book](../ch20-02-advanced-traits.html#default-generic-type-parameters-and-operator-overloading) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/first-edition/src/procedural-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The first edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch20-06-macros.html?highlight=procedural#procedural-macros-for-generating-code-from-attributes) instead.
version of the book](../ch20-05-macros.html?highlight=procedural#procedural-macros-for-generating-code-from-attributes) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/first-edition/src/type-aliases.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The first edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch20-04-advanced-types.html#creating-type-synonyms-with-type-aliases) instead.
version of the book](../ch20-03-advanced-types.html#creating-type-synonyms-with-type-aliases) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/first-edition/src/unsized-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The first edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch20-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait) instead.
version of the book](../ch20-03-advanced-types.html#dynamically-sized-types-and-the-sized-trait) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/redirects/associated-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ pub trait Iterator {
---

You can find the latest version of this information
[here](ch20-03-advanced-traits.html#specifying-placeholder-types-in-trait-definitions-with-associated-types).
[here](ch20-02-advanced-traits.html#specifying-placeholder-types-in-trait-definitions-with-associated-types).
2 changes: 1 addition & 1 deletion rustbook-en/redirects/macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn main() {

Here are the relevant sections in the new and old books:

* **[In the current edition: Ch 19.06 Macros][2]**
* **[In the current edition: Ch 20.05 Macros][2]**
* [Rust By Example: Macros][3]
* [In the Rust Reference: Ch 3.1 — Macros by Example][4]
* <small>[In the first edition: Ch 3.34 — Macros][1]</small>
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/redirects/match.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn value_in_cents(coin: Coin) -> u32 {
Here are the relevant sections in the new and old books:

* **[in the current edition: Ch 6.02 — The `match` Control Flow Operator][2]**
* [in the current edition: Ch 18.00 — Patterns][3]
* [in the current edition: Ch 19.00 — Patterns][3]
* <small>[In the first edition: Ch 3.14 — Match][1]</small>


Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/redirects/operators-and-overloading.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ fn main() {
---

You can find the latest version of this information
[here](ch20-03-advanced-traits.html).
[here](ch20-02-advanced-traits.html).
4 changes: 2 additions & 2 deletions rustbook-en/redirects/procedural-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
This chapter does not exist yet in [the second edition][2].
You can check out other resources that describe macros.

* **[In the current edition: Ch 19.06 Macros][2]**
* **[In the current edition: Ch 20.05 Macros][2]**
* [In the Rust Reference: Ch 3.2 — Procedural Macros][4]
* [The `proc_macro` crate documentation][3]
* <small>[In the first edition: Ch 4.13 — Procedural Macros (and custom Derive)][1]</small>


[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/procedural-macros.html
[2]: ch20-06-macros.html
[2]: ch20-05-macros.html
[3]: ../proc_macro/index.html
[4]: ../reference/procedural-macros.html
2 changes: 1 addition & 1 deletion rustbook-en/redirects/trait-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fn main() {

Here are the relevant sections in the new and old books:

* **[in the current edition: Ch 17.02 — Trait Objects][2]**
* **[in the current edition: Ch 18.02 — Trait Objects][2]**
* <small>[In the first edition: Ch 3.22 — Trait Objects][1]</small>


Expand Down
4 changes: 2 additions & 2 deletions rustbook-en/redirects/traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ pub trait Summarizable {
Here are the relevant sections in the new and old books:

* **[in the current edition: Ch 10.02 — Traits][2]**
* [in the current edition: Ch 19.03 — Advanced Traits][3]
* [in the current edition: Ch 20.02 — Advanced Traits][3]
* <small>[In the first edition: Ch 3.19 — Traits][1]</small>


[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/traits.html
[2]: ch10-02-traits.html
[3]: ch20-03-advanced-traits.html
[3]: ch20-02-advanced-traits.html
2 changes: 1 addition & 1 deletion rustbook-en/redirects/type-aliases.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ type Kilometers = i32;
---

You can find the latest version of this information
[here](ch20-04-advanced-types.html#creating-type-synonyms-with-type-aliases).
[here](ch20-03-advanced-types.html#creating-type-synonyms-with-type-aliases).
2 changes: 1 addition & 1 deletion rustbook-en/redirects/ufcs.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ fn main() {
---

You can find the latest version of this information
[here](ch20-03-advanced-traits.html#fully-qualified-syntax-for-disambiguation-calling-methods-with-the-same-name).
[here](ch20-02-advanced-traits.html#fully-qualified-syntax-for-disambiguation-calling-methods-with-the-same-name).
2 changes: 1 addition & 1 deletion rustbook-en/redirects/unsafe.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Here are the relevant sections in the new and old books:

* **[in the current edition: Ch 19.01 — Unsafe Rust][2]**
* **[in the current edition: Ch 20.01 — Unsafe Rust][2]**
* [The Rustonomicon, The Dark Arts of Advanced and Unsafe Rust Programming][3]
* <small>[In the first edition: Ch 3.36 — `unsafe`][1]</small>

Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/redirects/unsized-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ fn generic<T: ?Sized>(t: &T) {
---

You can find the latest version of this information
[here](ch20-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait).
[here](ch20-03-advanced-types.html#dynamically-sized-types-and-the-sized-trait).
2 changes: 1 addition & 1 deletion rustbook-en/second-edition/src/appendix-04-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The second edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch20-06-macros.html) instead.
version of the book](../ch20-05-macros.html) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/second-edition/src/ch19-03-advanced-traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The second edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch20-03-advanced-traits.html) instead.
version of the book](../ch20-02-advanced-traits.html) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/second-edition/src/ch19-04-advanced-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The second edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch20-04-advanced-types.html) instead.
version of the book](../ch20-03-advanced-types.html) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The second edition of the book is no longer distributed with Rust's documentation.

If you came here via a link or web search, you may want to check out [the current
version of the book](../ch20-05-advanced-functions-and-closures.html) instead.
version of the book](../ch20-04-advanced-functions-and-closures.html) instead.

If you have an internet connection, you can [find a copy distributed with
Rust
Expand Down
8 changes: 4 additions & 4 deletions rustbook-en/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@

- [Advanced Features](ch20-00-advanced-features.md)
- [Unsafe Rust](ch20-01-unsafe-rust.md)
- [Advanced Traits](ch20-03-advanced-traits.md)
- [Advanced Types](ch20-04-advanced-types.md)
- [Advanced Functions and Closures](ch20-05-advanced-functions-and-closures.md)
- [Macros](ch20-06-macros.md)
- [Advanced Traits](ch20-02-advanced-traits.md)
- [Advanced Types](ch20-03-advanced-types.md)
- [Advanced Functions and Closures](ch20-04-advanced-functions-and-closures.md)
- [Macros](ch20-05-macros.md)

- [Final Project: Building a Multithreaded Web Server](ch21-00-final-project-a-web-server.md)
- [Building a Single-Threaded Web Server](ch21-01-single-threaded.md)
Expand Down
3 changes: 2 additions & 1 deletion rustbook-en/src/appendix-01-keywords.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ described.
- `union` - define a [union][union]<!-- ignore -->; is only a keyword when used
in a union declaration
- `unsafe` - denote unsafe code, functions, traits, or implementations
- `use` - bring symbols into scope
- `use` - bring symbols into scope; specify precise captures for generic and
lifetime bounds
- `where` - denote clauses that constrain a type
- `while` - loop conditionally based on the result of an expression

Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/src/appendix-03-derivable-traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,4 @@ The `Default` trait is required when you use the method `unwrap_or_default` on
[creating-instances-from-other-instances-with-struct-update-syntax]: ch05-01-defining-structs.html#creating-instances-from-other-instances-with-struct-update-syntax
[stack-only-data-copy]: ch04-01-what-is-ownership.html#stack-only-data-copy
[ways-variables-and-data-interact-clone]: ch04-01-what-is-ownership.html#ways-variables-and-data-interact-clone
[macros]: ch20-06-macros.html#macros
[macros]: ch20-05-macros.html#macros
2 changes: 1 addition & 1 deletion rustbook-en/src/ch06-03-if-let.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ To make this common pattern nicer to express, Rust has `let`-`else`. The
`let`-`else` syntax takes a pattern on the left side and an expression on the
right, very similar to `if let`, but it does not have an `if` branch, only an
`else` branch. If the pattern matches, it will bind the value from the pattern
in the outer scope. If the pattern does *not* match, the program will flow into
in the outer scope. If the pattern does _not_ match, the program will flow into
the `else` arm, which must return from the function.

In Listing 6-9, you can see how Listing 6-8 looks when using `let`-`else` in
Expand Down
4 changes: 2 additions & 2 deletions rustbook-en/src/ch17-00-async-await.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ be nice if we could do something else while we are waiting for those
long-running processes to complete. Modern computers offer two techniques for
working on more than one operation at a time: parallelism and concurrency. Once
we start writing programs that involve parallel or concurrent operations,
though, we quickly encounter new challenges inherent to *asynchronous
programming*, where operations may not finish sequentially in the order they
though, we quickly encounter new challenges inherent to _asynchronous
programming_, where operations may not finish sequentially in the order they
were started. This chapter builds on Chapter 16’s use of threads for parallelism
and concurrency by introducing an alternative approach to asynchronous
programming: Rust’s Futures, Streams, the `async` and `await` syntax that
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/src/ch17-01-futures-and-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ futures passed to it finishes first.

> Note: Under the hood, `race` is built on a more general function, `select`,
> which you will encounter more often in real-world Rust code. A `select`
> function can do a lot of things that the `trpl::race` function can’t, but it
> function can do a lot of things that the `trpl::race` function can’t, but it
> also has some additional complexity that we can skip over for now.
Either future can legitimately “win,” so it doesn’t make sense to return a
Expand Down
3 changes: 3 additions & 0 deletions rustbook-en/src/ch17-02-concurrency-with-async.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Applying Concurrency with Async

<!-- Old headings. Do not remove or links may break. -->

<a id="concurrency-with-async"></a>

In this section, we’ll apply async to some of the same concurrency challenges
Expand All @@ -15,6 +16,7 @@ often have different behavior—and they nearly always have different performanc
characteristics.

<!-- Old headings. Do not remove or links may break. -->

<a id="counting"></a>

### Creating a New Task with `spawn_task`
Expand Down Expand Up @@ -178,6 +180,7 @@ For an extra challenge, see if you can figure out what the output will be in
each case _before_ running the code!

<!-- Old headings. Do not remove or links may break. -->

<a id="message-passing"></a>

### Counting Up on Two Tasks Using Message Passing
Expand Down
1 change: 1 addition & 0 deletions rustbook-en/src/ch17-03-more-futures.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ each other.
But _how_ would you hand control back to the runtime in those cases?

<!-- Old headings. Do not remove or links may break. -->

<a id="yielding"></a>

### Yielding Control to the Runtime
Expand Down
6 changes: 2 additions & 4 deletions rustbook-en/src/ch17-04-streams.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Streams: Futures in Sequence

<!-- Old headings. Do not remove or links may break. -->
<a id="streams"></a>

<a id="streams"></a>

So far in this chapter, we’ve mostly stuck to individual futures. The one big
exception was the async channel we used. Recall how we used the receiver for our
Expand Down Expand Up @@ -122,7 +122,7 @@ we can do that _is_ unique to streams.
### Composing Streams

Many concepts are naturally represented as streams: items becoming available in
a queue, chunks of data being pulled incrementally from the filesystem when the
a queue, chunks of data being pulled incrementally from the filesystem when the
full data set is too large for the computer’s , or data arriving over the
network over time. Because streams are futures, we can use them with any other
kind of future and combine them in interesting ways. For example, we can batch
Expand Down Expand Up @@ -174,8 +174,6 @@ Again, we could do this with the regular `Receiver` API or even the regular
timeout that applies to every item in the stream, and a delay on the items we
emit, as shown in Listing 17-34.



<Listing number="17-34" caption="Using the `StreamExt::timeout` method to set a time limit on the items in a stream" file-name="src/main.rs">

```rust
Expand Down
5 changes: 4 additions & 1 deletion rustbook-en/src/ch17-05-traits-for-async.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## A Closer Look at the Traits for Async

<!-- Old headings. Do not remove or links may break. -->

<a id="digging-into-the-traits-for-async"></a>

Throughout the chapter, we’ve used the `Future`, `Pin`, `Unpin`, `Stream`, and
Expand All @@ -12,6 +13,7 @@ details. In this section, we’ll dig in just enough to help in those scenarios,
still leaving the _really_ deep dive for other documentation.

<!-- Old headings. Do not remove or links may break. -->

<a id="future"></a>

### The `Future` Trait
Expand Down Expand Up @@ -118,6 +120,7 @@ future it is responsible for, putting the future back to sleep when it is not
yet ready.

<!-- Old headings. Do not remove or links may break. -->

<a id="pinning-and-the-pin-and-unpin-traits"></a>

### The `Pin` and `Unpin` Traits
Expand Down Expand Up @@ -210,7 +213,7 @@ enforce constraints on pointer usage.

Recalling that `await` is implemented in terms of calls to `poll` starts to
explain the error message we saw earlier, but that was in terms of `Unpin`, not
`Pin`. So how exactly does `Pin` relate to `Unpin`, and why does `Future` need
`Pin`. So how exactly does `Pin` relate to `Unpin`, and why does `Future` need
`self` to be in a `Pin` type to call `poll`?

Remember from earlier in this chapter a series of await points in a future get
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/src/ch18-02-trait-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,5 @@ that we wrote in Listing 18-5 and were able to support in Listing 18-9, so it’
a trade-off to consider.

[performance-of-code-using-generics]: ch10-01-syntax.html#performance-of-code-using-generics
[dynamically-sized]: ch20-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait
[dynamically-sized]: ch20-03-advanced-types.html#dynamically-sized-types-and-the-sized-trait
[dyn-compatibility]: https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility
Loading

0 comments on commit 1313ee7

Please sign in to comment.