Automatically add exercise links to sections. (#52)

We use an mdbook preprocessor to automatically generate links to the relevant exercise for each section.
We remove all existing manual links and refactor the deploy process to push the rendered book to a branch.
This commit is contained in:
Luca Palmieri
2024-05-24 18:15:38 +02:00
committed by GitHub
parent 99591a715e
commit 1aae615bb4
65 changed files with 1855 additions and 212 deletions

View File

@@ -15,6 +15,3 @@ Nailing the basics with a few exercises will get the language flowing under your
When we move on to more complex topics, such as traits and ownership, you'll be able to focus on the new concepts
without getting bogged down by the syntax or other trivial details.
## References
- The exercise for this section is located in `exercises/02_basic_calculator/00_intro`

View File

@@ -119,10 +119,6 @@ error[E0308]: mismatched types
We'll see how to convert between types [later in this course](../04_traits/09_from.md).
## References
- The exercise for this section is located in `exercises/02_basic_calculator/01_integers`
## Further reading
- [The integer types section](https://doc.rust-lang.org/book/ch03-02-data-types.html#integer-types) in the official Rust book

View File

@@ -97,8 +97,4 @@ help: consider assigning a value
| +++
```
## References
- The exercise for this section is located in `exercises/02_basic_calculator/02_variables`
[^speed]: The Rust compiler needs all the help it can get when it comes to compilation speed.

View File

@@ -100,6 +100,3 @@ In the example above, each branch of the `if` evaluates to a string literal,
which is then assigned to the `message` variable.\
The only requirement is that both `if` branches return the same type.
## References
- The exercise for this section is located in `exercises/02_basic_calculator/03_if_else`

View File

@@ -41,10 +41,6 @@ fn main() {
There are other mechanisms to work with recoverable errors in Rust, which [we'll cover later](../05_ticket_v2/06_fallibility.md).
For the time being we'll stick with panics as a brutal but simple stopgap solution.
## References
- The exercise for this section is located in `exercises/02_basic_calculator/04_panics`
## Further reading
- [The panic! macro documentation](https://doc.rust-lang.org/std/macro.panic.html)

View File

@@ -10,6 +10,3 @@ So far you've learned:
It looks like you're ready to tackle factorials!
## References
- The exercise for this section is located in `exercises/02_basic_calculator/05_factorial`

View File

@@ -80,10 +80,6 @@ while i <= 5 {
This will compile and run without errors.
## References
- The exercise for this section is located in `exercises/02_basic_calculator/06_while`
## Further reading
- [`while` loop documentation](https://doc.rust-lang.org/std/keyword.while.html)

View File

@@ -54,10 +54,6 @@ for i in 1..(end + 1) {
}
```
## References
- The exercise for this section is located in `exercises/02_basic_calculator/07_for`
## Further reading
- [`for` loop documentation](https://doc.rust-lang.org/std/keyword.for.html)

View File

@@ -100,10 +100,6 @@ Our recommendation is to enable `overflow-checks` for both profiles: it's better
incorrect results. The runtime performance hit is negligible in most cases; if you're working on a performance-critical
application, you can run benchmarks to decide if it's something you can afford.
## References
- The exercise for this section is located in `exercises/02_basic_calculator/08_overflow`
## Further reading
- Check out ["Myths and legends about integer overflow in Rust"](https://huonw.github.io/blog/2016/04/myths-and-legends-about-integer-overflow-in-rust/)

View File

@@ -35,9 +35,5 @@ The opposite happens for underflows: `0 - 1` is `-1`, which is smaller than `u8:
You can't get saturating arithmetic via the `overflow-checks` profile setting—you have to explicitly opt into it
when performing the arithmetic operation.
## References
- The exercise for this section is located in `exercises/02_basic_calculator/09_saturating`
[^method]: You can think of methods as functions that are "attached" to a specific type.
We'll cover methods (and how to define them) in the next chapter.

View File

@@ -94,10 +94,6 @@ When working with composite types, you'll have to rely on
different conversion mechanisms ([fallible](../05_ticket_v2/13_try_from.md)
and [infallible](../04_traits/09_from.md)), which we'll explore later on.
## References
- The exercise for this section is located in `exercises/02_basic_calculator/10_as_casting`
## Further reading
- Check out [Rust's official reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#numeric-cast)