Skip to content

Commit ed8daaa

Browse files
Merge branch 'slides/216-use-formatting-instead-of-quoted-strings' into 'master'
Resolve "Comprehensive Rust - use formatting instead of quoted strings" Closes #216 See merge request feng/training/material!293
2 parents 8ea1ab0 + f2ccc82 commit ed8daaa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+227
-228
lines changed

courses/comprehensive_rust_training/020_hello_world/03_playground.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ Playground
88

99
The :url:`Rust Playground <https://play.rust-lang.org/>` provides an easy
1010
way to run short Rust programs, and is the basis for the examples and
11-
exercises in this course. Try running the "hello-world" program it
11+
exercises in this course. Try running the :command:`hello-world` program it
1212
starts with. It comes with a few handy features:
1313

14-
- Under "Tools", use the :rust:`rustfmt` option to format your code in the
14+
- Under :menu:`Tools`, use the :menu:`rustfmt` option to format your code in the
1515
"standard" way.
1616

17-
- Rust has two main "profiles" for generating code: Debug (extra
18-
runtime checks, less optimization) and Release (fewer runtime checks,
19-
lots of optimization). These are accessible under "Debug" at the top.
17+
- Rust has two main :dfn:`profiles` for generating code: **Debug** (extra
18+
runtime checks, less optimization) and **Release** (fewer runtime checks,
19+
lots of optimization). These are accessible under :menu:`Debug` at the top.
2020

21-
- If you're interested, use "ASM" under "..." to see the generated
21+
- If you're interested, use :menu:`ASM` under :menu:`...` to see the generated
2222
assembly code.
2323

2424
---------

courses/comprehensive_rust_training/040_control_flow_basics/01_if.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
====================
2-
"if" expressions
3-
====================
1+
========================
2+
:rust:`if` expressions
3+
========================
44

5-
--------------------
6-
"if" expressions
7-
--------------------
5+
------------------------
6+
:rust:`if` expressions
7+
------------------------
88

99
You use
1010
:url:`if expressions <https://doc.rust-lang.org/reference/expressions/if-expr.html#if-expressions>`

courses/comprehensive_rust_training/040_control_flow_basics/02_match.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
=======================
2-
"match" Expressions
3-
=======================
1+
===========================
2+
:rust:`match` Expressions
3+
===========================
44

5-
-----------------------
6-
"match" Expressions
7-
-----------------------
5+
---------------------------
6+
:rust:`match` Expressions
7+
---------------------------
88

99
:rust:`match` can be used to check a value against one or more options:
1010

courses/comprehensive_rust_training/040_control_flow_basics/03_loops.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Loops
99
There are three looping keywords in Rust: :rust:`while`, :rust:`loop`, and
1010
:rust:`for`:
1111

12-
-----------
13-
"while"
14-
-----------
12+
---------------
13+
:rust:`while`
14+
---------------
1515

1616
The
1717
:url:`while keyword <https://doc.rust-lang.org/reference/expressions/loop-expr.html#predicate-loops>`
@@ -28,9 +28,9 @@ the condition is true.
2828
println!("Final x: {x}");
2929
}
3030
31-
-------------
32-
"for"
33-
-------------
31+
-----------------
32+
:rust:`for`
33+
-----------------
3434

3535
The :rust:`for` `loop <https://doc.rust-lang.org/std/keyword.for.html>`__
3636
iterates over ranges of values or the items in a collection:
@@ -47,19 +47,19 @@ iterates over ranges of values or the items in a collection:
4747
}
4848
}
4949
50-
---------------
51-
"for" Details
52-
---------------
50+
-------------------
51+
:rust:`for` Details
52+
-------------------
5353

5454
- Under the hood :rust:`for` loops use a concept called :dfn:`iterators` to
5555
handle iterating over different kinds of ranges/collections.
5656
Iterators will be discussed in more detail later.
5757
- Note that the first :rust:`for` loop only iterates to :rust:`4`. Show the
5858
:rust:`1..=5` syntax for an inclusive range.
5959

60-
--------------
61-
"loop"
62-
--------------
60+
------------------
61+
:rust:`loop`
62+
------------------
6363

6464
The :rust:`loop`
6565
`statement <https://doc.rust-lang.org/std/keyword.loop.html>`__ just
@@ -78,9 +78,9 @@ loops forever, until a :rust:`break`.
7878
}
7979
}
8080
81-
----------------
82-
"loop" Details
83-
----------------
81+
--------------------
82+
:rust:`loop` Details
83+
--------------------
8484

8585
- The :rust:`loop` statement works like a :rust:`while true` loop. Use it for
8686
things like servers which will serve connections forever.

courses/comprehensive_rust_training/040_control_flow_basics/04_break_continue.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
============================
2-
"break" and "continue"
3-
============================
1+
====================================
2+
:rust:`break` and :rust:`continue`
3+
====================================
44

5-
----------------------------
6-
"break" and "continue"
7-
----------------------------
5+
------------------------------------
6+
:rust:`break` and :rust:`continue`
7+
------------------------------------
88

99
If you want to immediately start the next iteration use
1010
:url:`continue <https://doc.rust-lang.org/reference/expressions/loop-expr.html#continue-expressions>`.

courses/comprehensive_rust_training/050_tuples_and_arrays/02_tuples.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ Details
2525
- Fields of a tuple can be accessed by the period and the index of the
2626
value, e.g. :rust:`t.0`, :rust:`t.1`.
2727

28-
- The empty tuple :rust:`()` is referred to as the "unit type" and
28+
- The empty tuple :rust:`()` is referred to as the :dfn:`unit type` and
2929
signifies absence of a return value, akin to :rust:`void` in other
3030
languages.

courses/comprehensive_rust_training/050_tuples_and_arrays/04_destructuring.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ larger value into its constituent parts:
3232
Details
3333
---------
3434

35-
- The patterns used here are "irrefutable", meaning that the compiler
35+
- The patterns used here are :dfn:`irrefutable`, meaning that the compiler
3636
can statically verify that the value on the right of :rust:`=` has the
3737
same structure as the pattern.
3838
- A variable name is an irrefutable pattern that always matches any

courses/comprehensive_rust_training/060_references/01_shared.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Shared References
77
-------------------
88

99
A reference provides a way to access another value without taking
10-
ownership of the value, and is also called "borrowing". Shared
10+
ownership of the value, and is also called :dfn:`borrowing`. Shared
1111
references are read-only, and the referenced data cannot change.
1212

1313
.. code:: rust
@@ -22,7 +22,7 @@ references are read-only, and the referenced data cannot change.
2222
}
2323
2424
A shared reference to a type :rust:`T` has type :rust:`&T`. A reference value is
25-
made with the :rust:`&` operator. The :rust:`*` operator "dereferences" a
25+
made with the :rust:`&` operator. The :rust:`*` operator :dfn:`dereferences` a
2626
reference, yielding its value.
2727

2828
---------
@@ -32,9 +32,9 @@ Details
3232
- References can never be null in Rust, so null checking is not
3333
necessary.
3434

35-
- A reference is said to "borrow" the value it refers to, and this is a
35+
- A reference is said to **borrow** the value it refers to, and this is a
3636
good model for students not familiar with pointers: code can use the
37-
reference to access the value, but is still "owned" by the original
37+
reference to access the value, but is still **owned** by the original
3838
variable. The course will get into more detail on ownership in day 3.
3939

4040
- References are implemented as pointers, and a key advantage is that

courses/comprehensive_rust_training/060_references/02_exclusive.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Details
2424

2525
Key points:
2626

27-
- "Exclusive" means that only this reference can be used to access the
27+
- :dfn:`Exclusive` means that only this reference can be used to access the
2828
value. No other references (shared or exclusive) can exist at the
2929
same time, and the referenced value cannot be accessed while the
3030
exclusive reference exists. Try making an :rust:`&point.0` or changing

courses/comprehensive_rust_training/070_user_defined_types/05_const.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
===========
2-
"const"
3-
===========
1+
===============
2+
:rust:`const`
3+
===============
44

5-
-----------
6-
"const"
7-
-----------
5+
---------------
6+
:rust:`const`
7+
---------------
88

99
Constants are evaluated at compile time and their values are inlined
1010
wherever they are used:

0 commit comments

Comments
 (0)