mirror of
https://github.com/rust-lang/book.git
synced 2026-04-02 04:44:21 -04:00
Highlight recommended path and lowlight the rest
Instead of placing the link to the recommended resource i.e. the second edition in second place, push it up to the top of the list. In fact, push the link to the first edition always at the bottom. To emphasise even more that's where new visitors should go, bolden the first link, and make the first-ed link smaller. All this as well as a slight edit and simplification of the copy is designed to make the new and recommended resources the primary path readers take, without hiding the old resource completely.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
% Associated Types
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Associated types are a way of associating a type placeholder with a trait such that the trait method definitions can use these placeholder types in their signatures.
|
||||
|
||||
@@ -13,12 +13,10 @@ pub trait Iterator {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.30 — Associated Types][1]
|
||||
|
||||
* [In the second edition: Ch 19.03 — Advanced Traits][2]
|
||||
* **[In the second edition: Ch 19.03 — Advanced Traits][2]**
|
||||
* <small>[In the first edition: Ch 3.30 — Associated Types][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/associated-types.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Attributes
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Any item declaration may have an attribute applied to it.
|
||||
|
||||
@@ -14,14 +14,10 @@ fn test_foo() {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
This particular chapter does not exist in the second edition.
|
||||
The best place to learn about it is [the Rust Reference][2].
|
||||
|
||||
* [In the first edition: Ch 3.27 — Attributes][1]
|
||||
|
||||
* [In the Rust Reference: Ch 5.3 — Attributes][2]
|
||||
* **[In the Rust Reference: Ch 5.3 — Attributes][2]**
|
||||
* <small>[In the first edition: Ch 3.27 — Attributes][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/attributes.html
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
% Bibliography
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
You can [continue to the exact older page][1].
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
This page does not exist in [the second edition][2].
|
||||
You might be interested in a similar page in [the Rust Reference][3].
|
||||
|
||||
* [In the first edition: Section 7 — Bibliography][1]
|
||||
* **[In the Rust Reference: Appendix — Influences][3]**
|
||||
* <small>[In the first edition: Section 7 — Bibliography][1]</small>
|
||||
|
||||
* [In the Rust Reference: Appendix — Influences][3]
|
||||
|
||||
[1]: first-edition/bibliography.html
|
||||
[2]: second-edition/index.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Borrow and AsRef
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> A cheap reference-to-reference conversion.
|
||||
> Used to convert a value to a reference value within generic code.
|
||||
@@ -13,14 +13,11 @@ fn is_hello<T: AsRef<str>>(s: T) {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
|
||||
This chapter does not exist in [the second edition][2].
|
||||
The best place to learn more about this is [the Rust documentation][3].
|
||||
|
||||
* [In the first edition: Ch 4.10 — Borrow and AsRef][1]
|
||||
|
||||
* [In the Rust documentation: `convert::AsRef`][3]
|
||||
* **[In the Rust documentation: `convert::AsRef`][3]**
|
||||
* <small>[In the first edition: Ch 4.10 — Borrow and AsRef][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/borrow-and-asref.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Casting between types
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> A type cast expression is denoted with the binary operator `as`.
|
||||
> Executing an `as` expression casts the value on the left-hand side to the type on the right-hand side.
|
||||
@@ -18,16 +18,13 @@ fn average(values: &[f64]) -> f64 {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
|
||||
* [In the first edition: Ch 3.29 — Casting between types][1]
|
||||
|
||||
* [In the second edition: Appendix B — Operators][2]
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* **[In the second edition: Appendix B — Operators, section Type Cast Expressions][2]**
|
||||
* [In the Rust Reference: Type Cast Expressions][3]
|
||||
|
||||
* [In the Rust documentation: `mem::transmute`][4]
|
||||
* <small>[In the first edition: Ch 3.29 — Casting between types][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/casting-between-types.html
|
||||
[2]: second-edition/appendix-02-operators.html#type-cast-expressions
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Choosing your Guarantees
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Smart pointers are data structures that act like a pointer, but they also have additional metadata and capabilities.
|
||||
> The different smart pointers defined in Rust’s standard library provide extra functionality beyond what references provide.
|
||||
@@ -12,12 +12,10 @@ println!("b = {}", b);
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 4.8 — Choosing your Guarantees][1]
|
||||
|
||||
* [In the second edition: Ch 15.00 — Smart Pointers][2]
|
||||
* **[In the second edition: Ch 15.00 — Smart Pointers][2]**
|
||||
* <small>[In the first edition: Ch 4.8 — Choosing your Guarantees][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/choosing-your-guarantees.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Closures
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Anonymous functions you can save in a variable or pass as arguments to other functions.
|
||||
|
||||
@@ -18,12 +18,10 @@ let expensive_closure = |num| {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.23 — Closures][1]
|
||||
|
||||
* [In the second edition: Ch 13.01 — Closures][2]
|
||||
* **[In the second edition: Ch 13.01 — Closures][2]**
|
||||
* <small>[In the first edition: Ch 3.23 — Closures][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/closures.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Comments
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Comments must start with two slashes and continue until the end of the line.
|
||||
> For comments that extend beyond a single line, you’ll need to include // on each line.
|
||||
@@ -13,12 +13,10 @@ There is a new edition of the book and this is an old link.
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.4 — Comments][1]
|
||||
|
||||
* [In the second edition: Ch 3.04 — Comments][2]
|
||||
* **[In the second edition: Ch 3.04 — Comments][2]**
|
||||
* <small>[In the first edition: Ch 3.4 — Comments][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/comments.html
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
% Compiler Plugins
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Compiler plugins are user-provided libraries that extend the compiler's behavior with new syntax extensions, lint checks, etc.
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
This particular chapter has moved to [the Unstable Book][2].
|
||||
|
||||
* **[In the Unstable Rust Book: `plugin`][2]**
|
||||
* <small><del>[In the first edition: Compiler Plugins][1]</del> (does not exist anymore)</small>
|
||||
|
||||
This particular chapter has moved to [a chapter in the Unstable
|
||||
Book][unstable book plugins]. Please check it out there.
|
||||
|
||||
[1]: first-edition/compiler-plugins.html
|
||||
[unstable book plugins]: ../unstable-book/language-features/plugin.html
|
||||
[2]: ../unstable-book/language-features/plugin.html
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
% Concurrency
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Historically, programming [concurrency] has been difficult and error prone: Rust hopes to change that.
|
||||
> Fearless concurrency allows you to write code that’s free of subtle bugs and is easy to refactor without introducing new bugs.
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 4.6 — Concurrency][1]
|
||||
|
||||
* [In the second edition: Ch 16.00 — Fearless Concurrency][2]
|
||||
* **[In the second edition: Ch 16.00 — Fearless Concurrency][2]**
|
||||
* <small>[In the first edition: Ch 4.6 — Concurrency][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/concurrency.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Conditional Compilation
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Sometimes one wants to have different compiler outputs from the same code, depending on build target, such as targeted operating system, or to enable release builds.
|
||||
> Configuration options are either provided by the compiler or passed in on the command line using.
|
||||
@@ -16,15 +16,13 @@ fn macos_only() {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
This particular chapter does not exist in [the second edition][2].
|
||||
The best place to learn about it is [the Rust Reference][3].
|
||||
|
||||
This particular chapter does not exist in the second edition.
|
||||
The best place to learn about it is [the Rust Reference][2].
|
||||
|
||||
* [In the first edition: Ch 4.3 — Conditional Compilation][1]
|
||||
|
||||
* [In the Rust Reference: Ch 5.3 — Attributes, Conditional Compilation section][2]
|
||||
* **[In the Rust Reference: Ch 5.3 — Attributes, Conditional Compilation section][3]**
|
||||
* <small>[In the first edition: Ch 4.3 — Conditional Compilation][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/conditional-compilation.html
|
||||
[2]: ../reference/attributes.html#conditional-compilation
|
||||
[2]: second-edition/
|
||||
[3]: ../reference/attributes.html#conditional-compilation
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% `const` and `static`
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Constants are _always_ immutable, and may only be set to a constant expression, not the result of a function call or any other value that could only be computed at runtime.
|
||||
>
|
||||
@@ -13,14 +13,11 @@ static HELLO_WORLD: &str = "Hello, world!";
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.26 — `const` and `static`][1]
|
||||
|
||||
* [In the second edition: Ch 3.01 — Variables and Mutability, section Constants][2]
|
||||
|
||||
* [In the second edition: Ch 19.01 — Unsafe Rust, section Static Variables][3]
|
||||
* **[In the second edition: Ch 3.01 — Variables and Mutability, section Constants][2]**
|
||||
* **[In the second edition: Ch 19.01 — Unsafe Rust, section Static Variables][3]**
|
||||
* <small>[In the first edition: Ch 3.26 — `const` and `static`][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/const-and-static.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Crates and Modules
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Rust has a module system that enables the reuse of code in an organized fashion.
|
||||
> A module is a namespace that contains definitions of functions or types, and you can choose whether those definitions are visible outside their module (public) or not (private).
|
||||
@@ -16,14 +16,11 @@ mod network {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
|
||||
* [In the first edition: Ch 3.25 — Crates and Modules][1]
|
||||
|
||||
* [In the second edition: Ch 7.01 — `mod` and the Filesystem][2]
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* **[In the second edition: Ch 7.01 — `mod` and the Filesystem][2]**
|
||||
* [In the second edition: Ch 14.02 — Publishing a Crate to Crates.io][2]
|
||||
* <small>[In the first edition: Ch 3.25 — Crates and Modules][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/crates-and-modules.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Deref coercions
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Implementing the `Deref` trait allows us to customize the behavior of the _dereference operator_ `*`.
|
||||
> By implementing `Deref` in such a way that a smart pointer can be treated like a regular reference, we can write code that operates on references and use that code with smart pointers too.
|
||||
@@ -20,12 +20,10 @@ impl<T> Deref for MyBox<T> {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.33 — Deref coercions][1]
|
||||
|
||||
* [In the second edition: Ch 15.02 — Treating Smart Pointers like Regular References with the `Deref` Trait][2]
|
||||
* **[In the second edition: Ch 15.02 — Treating Smart Pointers like Regular References with the `Deref` Trait][2]**
|
||||
* <small>[In the first edition: Ch 3.33 — Deref coercions][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/deref-coercions.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Documentation
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Documentation comments use `///` instead of `//` and support Markdown notation for formatting the text if you’d like.
|
||||
> You place documentation comments just before the item they are documenting.
|
||||
@@ -22,12 +22,10 @@ pub fn add_one(x: i32) -> i32 {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 4.4 — Documentation][1]
|
||||
|
||||
* [In the second edition: Ch 14.02 — Publishing to crates.io, section Making useful documentation][2]
|
||||
* **[In the second edition: Ch 14.02 — Publishing to crates.io, section Making useful documentation][2]**
|
||||
* <small>[In the first edition: Ch 4.4 — Documentation][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/documentation.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Drop
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> `Drop` lets us customize what happens when a value is about to go out of scope.
|
||||
|
||||
@@ -24,12 +24,10 @@ fn main() {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.20 — Drop][1]
|
||||
|
||||
* [In the second edition: Ch 15.03 — The `Drop` Trait Runs Code on Cleanup][2]
|
||||
* **[In the second edition: Ch 15.03 — The `Drop` Trait Runs Code on Cleanup][2]**
|
||||
* <small>[In the first edition: Ch 3.20 — Drop][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/drop.html
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
% Effective Rust
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
You can [continue to the exact older page][1].
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
This section does not exist in [the second edition][2].
|
||||
However, the second edition encourages writing effective Rust from the start.
|
||||
It is recommended to start there.
|
||||
|
||||
* [In the first edition: Ch 4 — Effective Rust][1]
|
||||
|
||||
* [The second edition of The Rust Programming Language][2]
|
||||
* **[The second edition of The Rust Programming Language][2]**
|
||||
* <small>[In the first edition: Ch 4 — Effective Rust][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/effective-rust.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Enums
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Enums allow you to define a type by enumerating its possible values.
|
||||
|
||||
@@ -13,12 +13,10 @@ enum IpAddrKind {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.13 — Enums][1]
|
||||
|
||||
* [In the second edition: Ch 6.01 — Defining an Enum][2]
|
||||
* **[In the second edition: Ch 6.01 — Defining an Enum][2]**
|
||||
* <small>[In the first edition: Ch 3.13 — Enums][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/enums.html
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
% Error Handling
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Rust groups errors into two major categories: _recoverable_ errors with `Result<T, E>` and _unrecoverable_ errors with `panic!`.
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 4.7 — Error Handling][1]
|
||||
|
||||
* [In the second edition: Ch 9.00 — Error Handling][2]
|
||||
* **[In the second edition: Ch 9.00 — Error Handling][2]**
|
||||
* <small>[In the first edition: Ch 4.7 — Error Handling][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/error-handling.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% FFI
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Sometimes, your Rust code may need to interact with code written in another language.
|
||||
> To do this, Rust has a keyword, `extern`, that facilitates creating and using a _Foreign Function Interface_ (FFI).
|
||||
@@ -19,12 +19,10 @@ fn main() {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 4.9 — FFI][1]
|
||||
|
||||
* [In the second edition: Ch 19.01 — Unsafe Rust, section `extern` functions][2]
|
||||
* **[In the second edition: Ch 19.01 — Unsafe Rust, section `extern` functions][2]**
|
||||
* <small>[In the first edition: Ch 4.9 — FFI][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/ffi.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Functions
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Function definitions in Rust start with `fn` and have a set of parentheses after the function name.
|
||||
> The curly brackets tell the compiler where the function body begins and ends.
|
||||
@@ -20,12 +20,10 @@ fn another_function() {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.2 — Functions][1]
|
||||
|
||||
* [In the second edition: Ch 3.03 — Functions][2]
|
||||
* **[In the first edition: Ch 3.2 — Functions][1]**
|
||||
* <small>[In the second edition: Ch 3.03 — Functions][2]</small>
|
||||
|
||||
|
||||
[1]: first-edition/functions.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Generics
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Generics are abstract stand-ins for concrete types or other properties.
|
||||
|
||||
@@ -19,12 +19,10 @@ fn main() {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.18 — Generics][1]
|
||||
|
||||
* [In the second edition: Ch 10.00 — Generic Types, Traits, and Lifetimes][2]
|
||||
* **[In the second edition: Ch 10.00 — Generic Types, Traits, and Lifetimes][2]**
|
||||
* <small>[In the first edition: Ch 3.18 — Generics][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/generics.html
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
% Getting Started
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
|
||||
* [In the first edition: Getting Started][1]
|
||||
|
||||
* [In the second edition: Introduction][2]
|
||||
* **[In the second edition: Introduction][2]**
|
||||
* <small>[In the first edition: Getting Started][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/getting-started.html
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
% Glossary
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
You can [continue to the exact older page][1].
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
This section does not exist in [the second edition][2].
|
||||
However, the second edition defines the terms it uses inline, rather than using a glossary.
|
||||
It is recommended to start there.
|
||||
|
||||
* [In the first edition: Glossary][1]
|
||||
|
||||
* [The second edition of The Rust Programming Language][2]
|
||||
* **[The second edition of The Rust Programming Language][2]**
|
||||
* <small>[In the first edition: Glossary][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/glossary.html
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
% Tutorial: Guessing Game
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
You can [continue to the exact older page][1].
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
|
||||
* [In the first edition: Tutorial — Guessing Game][1]
|
||||
|
||||
* [In the second edition: Ch 2.00 — Guessing Game tutorial][2]
|
||||
* **[In the first edition: Tutorial — Guessing Game][1]**
|
||||
* <small>[In the second edition: Ch 2.00 — Guessing Game tutorial][2]</small>
|
||||
|
||||
|
||||
[1]: first-edition/guessing-game.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% if let
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> The `if let` syntax lets you combine `if` and `let` into a less verbose way to handle values that match one pattern and ignore the rest.
|
||||
|
||||
@@ -13,12 +13,10 @@ if let Some(3) = some_u8_value {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.21 — if let][1]
|
||||
|
||||
* [In the second edition: Ch 6.03 — Concise Control Flow with `if let`][2]
|
||||
* **[In the second edition: Ch 6.03 — Concise Control Flow with `if let`][2]**
|
||||
* <small>[In the first edition: Ch 3.21 — if let][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/if-let.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% if
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> An `if` expression allows us to branch our code depending on conditions.
|
||||
|
||||
@@ -18,12 +18,10 @@ fn main() {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.5 — if][1]
|
||||
|
||||
* [In the second edition: Ch 3.05 — Control flow][2]
|
||||
* **[In the second edition: Ch 3.05 — Control flow][2]**
|
||||
* <small>[In the first edition: Ch 3.5 — if][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/if.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Iterators
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> The iterator pattern allows you to perform some task on a sequence of items in turn.
|
||||
> An iterator is responsible for the logic of iterating over each item and determining when the sequence has finished.
|
||||
@@ -17,12 +17,10 @@ for val in v1_iter {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 4.5 — Iterators][1]
|
||||
|
||||
* [In the second edition: Ch 13.02 — Iterators][2]
|
||||
* **[In the second edition: Ch 13.02 — Iterators][2]**
|
||||
* <small>[In the first edition: Ch 4.5 — Iterators][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/iterators.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Lifetimes
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Every reference in Rust has a lifetime, which is the scope for which that reference is valid.
|
||||
> Most of the time lifetimes are implicit and inferred.
|
||||
@@ -18,14 +18,11 @@ There is a new edition of the book and this is an old link.
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
|
||||
* [In the first edition: Ch 3.10 — Lifetimes][1]
|
||||
|
||||
* [In the second edition: Ch 10.03 — Lifetimes][2]
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* **[In the second edition: Ch 10.03 — Lifetimes][2]**
|
||||
* [In the second edition: Ch 19.02 — Advanced Lifetimes][3]
|
||||
* <small>[In the first edition: Ch 3.10 — Lifetimes][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/lifetimes.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Loops
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Rust has three kinds of loops: `loop`, `while`, and `for`.
|
||||
> The `loop` keyword tells Rust to execute a block of code over and over again forever or until you explicitly tell it to stop.
|
||||
@@ -26,12 +26,10 @@ for element in a.iter() {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.6 — Loops][1]
|
||||
|
||||
* [In the second edition: Ch 3.05 — Control flow][2]
|
||||
* **[In the second edition: Ch 3.05 — Control flow][2]**
|
||||
* <small>[In the first edition: Ch 3.6 — Loops][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/loops.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Macros
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> While functions and types abstract over code, macros abstract at a syntactic level.
|
||||
|
||||
@@ -16,18 +16,14 @@ fn main() {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
|
||||
This chapter does not exist yet in [the second edition][2].
|
||||
You can check out other resources that describe macros.
|
||||
|
||||
* [In the first edition: Ch 3.34 — Macros][1]
|
||||
|
||||
* [In the second edition: (future) Appendix E — Macros][2]
|
||||
|
||||
* [Rust By Example: Macros][3]
|
||||
|
||||
* **[Rust By Example: Macros][3]**
|
||||
* [In the Rust Reference: Ch 3.1 — Macros by Example][4]
|
||||
* [In the second edition: (future) Appendix E — Macros][2]
|
||||
* <small>[In the first edition: Ch 3.34 — Macros][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/macros.html
|
||||
[2]: second-edition/appendix-05-macros.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Match
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> `match` allows us to compare a value against a series of patterns and then execute code based on which pattern matches.
|
||||
> Patterns can be made up of literal values, variable names, wildcards, and many other things.
|
||||
@@ -25,14 +25,11 @@ fn value_in_cents(coin: Coin) -> u32 {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
|
||||
* [In the first edition: Ch 3.14 — Match][1]
|
||||
|
||||
* [In the second edition: Ch 6.02 — The `match` Control Flow Operator][2]
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* **[In the second edition: Ch 6.02 — The `match` Control Flow Operator][2]**
|
||||
* [In the second edition: Ch 18.00 — Patterns][3]
|
||||
* <small>[In the first edition: Ch 3.14 — Match][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/match.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Method Syntax
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Methods are different from functions in that they’re defined within the context of a struct, and their first parameter is always `self`, which represents the instance of the struct the method is being called on.
|
||||
|
||||
@@ -19,12 +19,10 @@ impl Rectangle {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.16 — Method Syntax][1]
|
||||
|
||||
* [In the second edition: Ch 5.03 — Method Syntax][2]
|
||||
* **[In the second edition: Ch 5.03 — Method Syntax][2]**
|
||||
* <small>[In the first edition: Ch 3.16 — Method Syntax][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/method-syntax.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Mutability
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Variables are immutable only by default; we can make them mutable by adding mut in front of the variable name.
|
||||
|
||||
@@ -13,12 +13,10 @@ println!("The value of x is: {}", x);
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.11 — Mutability][1]
|
||||
|
||||
* [In the second edition: Ch 3.01 — Variables and Mutability][2]
|
||||
* **[In the second edition: Ch 3.01 — Variables and Mutability][2]**
|
||||
* <small>[In the first edition: Ch 3.11 — Mutability][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/mutability.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Operators and Overloading
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Rust does not allow you to create your own operators or overload arbitrary operators, but the operations and corresponding traits listed in `std::ops` can be overloaded by implementing the traits associated with the operator.
|
||||
|
||||
@@ -32,14 +32,11 @@ fn main() {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
|
||||
* [In the first edition: Ch 3.32 — Operators and Overloading][1]
|
||||
|
||||
* [In the second edition: Ch 19.03 — Advanced Traits, section Operator Overloading][2]
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* **[In the second edition: Ch 19.03 — Advanced Traits, section Operator Overloading][2]**
|
||||
* [In the Rust documentation: `std::ops`][3]
|
||||
* <small>[In the first edition: Ch 3.32 — Operators and Overloading][1]</small>
|
||||
|
||||
[1]: first-edition/operators-and-overloading.html
|
||||
[2]: second-edition/ch19-03-advanced-traits.html#operator-overloading-and-default-type-parameters
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Ownership
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Ownership is Rust’s most unique feature, and it enables Rust to make memory safety guarantees without needing a garbage collector.
|
||||
>
|
||||
@@ -10,12 +10,10 @@ There is a new edition of the book and this is an old link.
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.8 — Ownership][1]
|
||||
|
||||
* [In the second edition: Ch 4.00 — Understanding Ownership][2]
|
||||
* **[In the second edition: Ch 4.00 — Understanding Ownership][2]**
|
||||
* <small>[In the first edition: Ch 3.8 — Ownership][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/ownership.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Patterns
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Patterns are a special syntax within Rust for matching against the structure of our types, complex or simple.
|
||||
> A pattern is made up of some combination of literals; destructured arrays, enums, structs, or tuples; variables, wildcards, and placeholders.
|
||||
@@ -19,14 +19,11 @@ match x {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
|
||||
* [In the first edition: Ch 3.15 — Patterns][1]
|
||||
|
||||
* [In the second edition: Ch 18.03 — Patterns][2]
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* **[In the second edition: Ch 18.03 — Patterns][2]**
|
||||
* [In the second edition: Ch 6.02 — Match][3]
|
||||
* <small>[In the first edition: Ch 3.15 — Patterns][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/patterns.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Primitive Types
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Rust is a _statically typed_ language, which means that it must know the types of all variables at compile time.
|
||||
> The compiler can usually infer what type we want to use based on the value and how we use it.
|
||||
@@ -14,12 +14,10 @@ let y: f32 = 3.0; // f32
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.3 — Primitive Types][1]
|
||||
|
||||
* [In the second edition: Ch 3.02 — Data Types][2]
|
||||
* **[In the second edition: Ch 3.02 — Data Types][2]**
|
||||
* <small>[In the first edition: Ch 3.3 — Primitive Types][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/primitive-types.html
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
% Procedural Macros (and custom Derive)
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Procedural macros allow for all sorts of advanced metaprogramming in Rust.
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
|
||||
This chapter does not exist yet in [the second edition][2].
|
||||
You can check out other resources that describe macros.
|
||||
|
||||
* [In the first edition: Ch 4.13 — Procedural Macros (and custom Derive)][1]
|
||||
|
||||
* [In the second edition: Appendix E — Macros][2]
|
||||
|
||||
* **[In the Rust Reference: Ch 3.2 — Procedural Macros][4]**
|
||||
* [The `proc_macro` crate documentation][3]
|
||||
* [In the second edition: (future) Appendix E — Macros][2]
|
||||
* <small>[In the first edition: Ch 4.13 — Procedural Macros (and custom Derive)][1]</small>
|
||||
|
||||
* [In the Rust Reference: Ch 3.2 — Procedural Macros][4]
|
||||
|
||||
[1]: first-edition/procedural-macros.html
|
||||
[2]: second-edition/appendix-05-macros.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Raw Pointers
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Raw pointers are allowed to ignore many of the rules that references have to follow.
|
||||
|
||||
@@ -13,12 +13,10 @@ let r2 = &mut num as *mut i32;
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.35 — Raw Pointers][1]
|
||||
|
||||
* [In the second edition: Ch 19.01 — Unsafe Rust, section Dereferencing a Raw Pointer][2]
|
||||
* **[In the second edition: Ch 19.01 — Unsafe Rust, section Dereferencing a Raw Pointer][2]**
|
||||
* <small>[In the first edition: Ch 3.35 — Raw Pointers][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/raw-pointers.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% References and Borrowing
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> A reference _refers_ to a value but does not own it.
|
||||
> Because it does not own it, the value it points to will not be dropped when the reference goes out of scope.
|
||||
@@ -14,12 +14,10 @@ fn calculate_length(s: &String) -> usize { // s is a reference to a String
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.9 — References and Borrowing][1]
|
||||
|
||||
* [In the second edition: Ch 4.02 — References and Borrowing][2]
|
||||
* **[In the second edition: Ch 4.02 — References and Borrowing][2]**
|
||||
* <small>[In the first edition: Ch 3.9 — References and Borrowing][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/references-and-borrowing.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Release Channels
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> The Rust project uses a concept called ‘release channels’ to manage releases.
|
||||
> New nightly releases are created once a day.
|
||||
@@ -8,20 +8,17 @@ There is a new edition of the book and this is an old link.
|
||||
> At that point, it will only receive patches to fix serious errors.
|
||||
> Six weeks later, the beta is promoted to ‘Stable’.
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
---
|
||||
|
||||
This chapter does not exist yet in [the second edition][2].
|
||||
You can check out other resources that describe release channels.
|
||||
|
||||
* [In the first edition: Ch 4.11 — Release Channels][1]
|
||||
|
||||
* [In the second edition: Appendix D — Nightly Rust][2]
|
||||
|
||||
* [In the Rust RFCs: RFC 507 — Release Channels][3]
|
||||
|
||||
* [In the Rustup documentation: Keeping Rust Up-to-date][4]
|
||||
|
||||
* **[In the Rustup documentation: Keeping Rust Up-to-date][4]**
|
||||
* [On the website: Install Rust][5]
|
||||
* [In the Rust RFCs: RFC 507 — Release Channels][3]
|
||||
* [In the second edition: (future) Appendix D — Nightly Rust][2]
|
||||
* <small>[In the first edition: Ch 4.11 — Release Channels][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/release-channels.html
|
||||
[2]: second-edition/appendix-04-nightly-rust.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Strings
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> A `String` is allocated on the heap and as such is able to store an amount of text that is unknown to us at compile time.
|
||||
> You can create a `String` from a string literal using the `from` function.
|
||||
@@ -15,16 +15,12 @@ let world = &s[6..11];
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
|
||||
* [In the first edition: Ch 3.17 — Strings][1]
|
||||
|
||||
* [In second edition: Ch 8.02 — Strings][2]
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* **[In second edition: Ch 8.02 — Strings][2]**
|
||||
* [In second edition: Ch 4.01 — Ownership, section The String Type][3]
|
||||
|
||||
* [In second edition: Ch 4.03 — Slices, section String Slices][4]
|
||||
* <small>[In the first edition: Ch 3.17 — Strings][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/strings.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Structs
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> A _struct_ is a custom data type that lets us name and package together multiple related values that make up a meaningful group.
|
||||
|
||||
@@ -15,12 +15,10 @@ struct User {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.12 — Structs][1]
|
||||
|
||||
* [In second edition: Ch 5.00 — Structs][2]
|
||||
* **[In second edition: Ch 5.00 — Structs][2]**
|
||||
* <small>[In the first edition: Ch 3.12 — Structs][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/structs.html
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
% Syntax and Semantics
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
* [In the first edition: Ch 3 — Syntax and Semantics][1]
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the second edition: Ch 3.00 — Common Programming Concepts][2]
|
||||
|
||||
* **[In the second edition: Ch 3.00 — Common Programming Concepts][2]**
|
||||
* [In the second edition: Appendix A — Keywords][3]
|
||||
|
||||
* [In the second edition: Appendix B — Operators][4]
|
||||
* <small>[In the first edition: Ch 3 — Syntax and Semantics][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/syntax-and-semantics.html
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
% Syntax Index
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
* [In the first edition: Ch 6 — Syntax Index][1]
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the second edition: Appendix A — Keywords][2]
|
||||
|
||||
* [In the second edition: Appendix B — Operators][3]
|
||||
* **[In the second edition: Appendix A — Keywords][2]**
|
||||
* **[In the second edition: Appendix B — Operators][3]**
|
||||
* <small>[In the first edition: Ch 6 — Syntax Index][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/syntax-index.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Testing
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Rust includes support for writing software tests within the language itself.
|
||||
|
||||
@@ -15,12 +15,10 @@ mod tests {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 4.2 — Testing][1]
|
||||
|
||||
* [In the second edition: Ch 11.00 — Testing][2]
|
||||
* **[In the second edition: Ch 11.00 — Testing][2]**
|
||||
* <small>[In the first edition: Ch 4.2 — Testing][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/testing.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% The Stack and the Heap
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Both the stack and the heap are parts of memory that is available to your code to use at runtime, but they are structured in different ways.
|
||||
> The stack stores values in the order it gets them and removes the values in the opposite order.
|
||||
@@ -9,12 +9,10 @@ There is a new edition of the book and this is an old link.
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 4.1 — The Stack and the Heap][1]
|
||||
|
||||
* [In the second edition: Ch 4.01 — What is Ownership, section The Stack and the Heap][2]
|
||||
* **[In the second edition: Ch 4.01 — What is Ownership, section The Stack and the Heap][2]**
|
||||
* <small>[In the first edition: Ch 4.1 — The Stack and the Heap][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/the-stack-and-the-heap.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Trait Objects
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Trait objects combine the data made up of the pointer to a concrete object with the behavior of the methods defined in the trait.
|
||||
> A trait defines behavior that we need in a given situation.
|
||||
@@ -58,12 +58,10 @@ fn main() {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.22 — Trait Objects][1]
|
||||
|
||||
* [In the second edition: Ch 17.02 — Trait Objects][2]
|
||||
* **[In the second edition: Ch 17.02 — Trait Objects][2]**
|
||||
* <small>[In the first edition: Ch 3.22 — Trait Objects][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/trait-objects.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Traits
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Traits abstract over behavior that types can have in common.
|
||||
|
||||
@@ -12,14 +12,11 @@ pub trait Summarizable {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
|
||||
* [In the first edition: Ch 3.19 — Traits][1]
|
||||
|
||||
* [In the second edition: Ch 10.02 — Traits][2]
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* **[In the second edition: Ch 10.02 — Traits][2]**
|
||||
* [In the second edition: Ch 19.03 — Advanced Traits][3]
|
||||
* <small>[In the first edition: Ch 3.19 — Traits][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/traits.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% `type` aliases
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Rust provides the ability to declare a _type alias_ with the `type` keyword to give an existing type another name.
|
||||
|
||||
@@ -10,12 +10,10 @@ type Kilometers = i32;
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.28 — `type` aliases][1]
|
||||
|
||||
* [In the second edition: Ch 19.04 — Advanced Types, section Type Synonyms][2]
|
||||
* **[In the second edition: Ch 19.04 — Advanced Types, section Type Synonyms][2]**
|
||||
* <small>[In the first edition: Ch 3.28 — `type` aliases][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/type-aliases.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Universal Function Call Syntax
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Rust cannot prevent a trait from having a method with the same name as another trait’s method, nor can it prevent us from implementing both of these traits on one type.
|
||||
> In order to be able to call each of the methods with the same name, then, we need to tell Rust which one we want to use.
|
||||
@@ -44,12 +44,10 @@ fn main() {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.24 — Universal Function Call Syntax][1]
|
||||
|
||||
* [In the second edition: Ch 19.03 — Advanced Traits, section Fully Qualified Syntax][2]
|
||||
* **[In the second edition: Ch 19.03 — Advanced Traits, section Fully Qualified Syntax][2]**
|
||||
* <small>[In the first edition: Ch 3.24 — Universal Function Call Syntax][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/ufcs.html
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
% `unsafe`
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Rust has a second language hiding out inside of it, unsafe Rust, which does not enforce memory safety guarantees.
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
|
||||
* [In the first edition: Ch 3.36 — `unsafe`][1]
|
||||
|
||||
* [In the second edition: Ch 19.01 — Unsafe Rust][2]
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* **[In the second edition: Ch 19.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>
|
||||
|
||||
|
||||
[1]: first-edition/unsafe.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Unsized Types
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Sometimes referred to as ‘DSTs’ or ‘unsized types’, these types let us talk about types whose size we can only know at runtime.
|
||||
> The `Sized` trait is automatically implemented for everything the compiler knows the size of at compile time.
|
||||
@@ -14,12 +14,10 @@ fn generic<T: ?Sized>(t: &T) {
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.31 — Unsized Types][1]
|
||||
|
||||
* [In the second edition: Ch 19.04 — Advanced Types, section Dynamically Sized Types][2]
|
||||
* **[In the second edition: Ch 19.04 — Advanced Types, section Dynamically Sized Types][2]**
|
||||
* <small>[In the first edition: Ch 3.31 — Unsized Types][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/unsized-types.html
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
% Using Rust without the Standard Library
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Rust’s standard library provides a lot of useful functionality, but assumes support for various features of its host system: threads, networking, heap allocation, and others.
|
||||
> There are systems that do not have these features, however.
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
This particular chapter has moved to [the Unstable Book][2].
|
||||
|
||||
This particular chapter has moved to [a chapter in the Unstable Book][2].
|
||||
Please check it out there.
|
||||
|
||||
* [In the first edition: Ch 4.12 — Using Rust without the Standard Library][1]
|
||||
|
||||
* [In the Unstable Rust Book: `lang_items` — Writing an executable without stdlib][2]
|
||||
* **[In the Unstable Rust Book: `lang_items` — Writing an executable without stdlib][2]**
|
||||
* <small>[In the first edition: Ch 4.12 — Using Rust without the Standard Library][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/using-rust-without-the-standard-library.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Variable Bindings
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Variable bindings bind some value to a name, so it can be used later.
|
||||
|
||||
@@ -10,12 +10,10 @@ let foo = 5;
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.1 — Variable Bindings][1]
|
||||
|
||||
* [In the second edition: Ch 2.00 — Guessing Game Tutorial, section Variables][2]
|
||||
* **[In the second edition: Ch 2.00 — Guessing Game Tutorial, section Variables][2]**
|
||||
* <small>[In the first edition: Ch 3.1 — Variable Bindings][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/variable-bindings.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
% Vectors
|
||||
|
||||
There is a new edition of the book and this is an old link.
|
||||
<small>There is a new edition of the book and this is an old link.</small>
|
||||
|
||||
> Vectors store more than one value in a single data structure that puts all the values next to each other in memory.
|
||||
> Vectors can only store values of the same type.
|
||||
@@ -12,12 +12,10 @@ let numbers = vec![1, 2, 3];
|
||||
|
||||
---
|
||||
|
||||
You can [continue to the exact older page][1].
|
||||
If you're trying to learn Rust, checking out [the second edition][2] might be a better choice.
|
||||
Here are the relevant sections in the new and old books:
|
||||
|
||||
* [In the first edition: Ch 3.7 — Vectors][1]
|
||||
|
||||
* [In the second edition: Ch 8.01 — Vectors][2]
|
||||
* **[In the second edition: Ch 8.01 — Vectors][2]**
|
||||
* <small>[In the first edition: Ch 3.7 — Vectors][1]</small>
|
||||
|
||||
|
||||
[1]: first-edition/vectors.html
|
||||
|
||||
Reference in New Issue
Block a user