1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-04 11:39:42 +02:00
Commit Graph

343 Commits

Author SHA1 Message Date
Igor Petruk
30291800ec
Update vec.md (#240)
Adding Speaker Notes about type inference in collections and `vec![]` macro.
2023-01-23 10:04:52 -08:00
Igor Petruk
49c9ba692e
Update static-and-const.md (#215)
Let's not use the word "lifetime" just yet. It is arguably the heaviest topic in Rust and it was not yet introduced.
2023-01-23 17:15:54 +01:00
Igor Petruk
c116ef8567
Update Speaker Notes in modern.md (#206)
Adding a mention of LSP and rust-analyzer
2023-01-23 17:12:24 +01:00
Martin Geisler
1f37933b8b
Extract common build steps to composite actions (#242)
* Extract common build steps to composite actions

This allows us to repeat ourselves less across the different jobs.

I also tested using a “reusable workflow” to factor out the common
steps. However, this starts a separate job without a shared
filesystem, which in turn requires us to upload/download artifacts
when we want to use them in several jobs. The artifacts are downloaded
one-by-one and this adds delays and extra steps to all jobs.

* Move Rust cache setup to its own build step

This made it easy to consistently setup the caching of our nested
projects via the “workspacs” config key.
2023-01-23 17:08:29 +01:00
Igor Petruk
543cad59e4
Update result.md (#250)
* Update result.md

Adding a speaker note that `Result` documentation is a recommended read.

* Adding a note why `Result` encourages error checking.

* Wordsmithing

Co-authored-by: Andrew Walbran <qwandor@google.com>
2023-01-23 13:47:41 +00:00
Igor Petruk
10bd1616cb
Update iterator.md (#244)
* Update iterator.md

Adding a Speaker Note emphasizing that all most all functional programming toolbox over collections can be found in the `Iterator` documentation.

* Wordsmithing

Co-authored-by: Andrew Walbran <qwandor@google.com>
2023-01-23 13:45:45 +00:00
Igor Petruk
6b75f9e69c
Update impl-trait.md (#249)
Adding an extra speaker note why `impl Display` is used very appropriately here and what would go wrong if we tried `T: Display`.
2023-01-23 13:41:14 +00:00
Igor Petruk
cde1c433f6
Update trait-bounds.md (#248)
Mentioning `where` clause syntax in speaker notes.
2023-01-23 13:39:23 +00:00
Igor Petruk
b75e713792
Update methods.md (#247)
Adding a Q/A about `impl<T> Point<T>`, why is it specified twice.
2023-01-23 13:38:53 +00:00
Igor Petruk
05cc2ff480
Update from-into.md (#245)
Explaining how those traits are used in practice and when you should use one over another.
2023-01-23 13:18:34 +00:00
Igor Petruk
12c3e2989d
Update match-guards.md (#233)
* Update match-guards.md

Adding more information how match guards are different from simply using "if" inside of the match case, after the case has matched.

* Be consistent about naming of match arms.

Co-authored-by: Andrew Walbran <qwandor@google.com>
2023-01-23 13:09:32 +00:00
Igor Petruk
91487289d2
Update box-recursive.md (#241)
* Update box-recursive.md

Adding Speaker Notes. This is a high-level guideline what to say, so we can settle on one explanation and review it.
This may be very obvious with the background in some languages, but be very non-obvious in languages that always
use references and never embed structs into structs.

* Fix wording

Co-authored-by: Andrew Walbran <qwandor@google.com>
2023-01-23 12:54:06 +00:00
Igor Petruk
6b6c553789
Update if-expressions.md (#236)
* Update if-expressions.md

Adding a note about types of `if` branch blocks.

* Fix typo and simplify.

Co-authored-by: Andrew Walbran <qwandor@google.com>
2023-01-23 12:44:20 +00:00
Andrew Walbran
20e83166f4 Mention alloc too 2023-01-23 12:44:07 +00:00
Igor Petruk
567a570d59 Update std.md
Addition a mention of existence of `core` Standard Library.
2023-01-23 12:44:07 +00:00
Igor Petruk
66509f2f3e
Update for-expressions.md (#238)
If we are introducing `for` loops, I think it is beneficial to show a very basic `for i=0; i < 10; i+=2` too.
2023-01-23 12:04:42 +00:00
Igor Petruk
581f5a4008
Update blocks.md (#235)
Adding the important note about ";" in blocks.
2023-01-23 12:03:06 +00:00
Charisee Chiw
56757566b3
Speaker notes for enums.md (#199)
* Update enums.md

* Update enums.md
2023-01-23 11:58:49 +00:00
Charisee Chiw
be2bb2d4c5
Speaker notes for Method example (#203)
* Speaker notes for Method example

* Update example.md
2023-01-23 11:53:33 +00:00
Igor Petruk
94ed176761
Update destructuring-enums.md (#231) 2023-01-23 11:40:02 +00:00
Igor Petruk
ef119bc0d3
Update receiver.md (#229)
The key takeaway is mutability of receivers and the rules that come with it. It might be a repetition of borrow checker rules, but it is important to know they apply to `self` as to any other variable or argument.
2023-01-23 11:39:38 +00:00
Igor Petruk
c109dabf5f
Update tuple-structs.md (#226)
* Update tuple-structs.md

I am adding more information about newtypes. The speaker can get questions about it or may wish to encourage this great pattern.

* Fix typos and explanation

Co-authored-by: Andrew Walbran <qwandor@google.com>
2023-01-23 11:38:37 +00:00
Igor Petruk
d1588e4f2f
Update scopes-shadowing.md (#216)
Adding the definition of what shadowing is and how it is different from mutation.
2023-01-23 11:38:11 +00:00
Igor Petruk
71ce061cc2
Update lifetimes-data-structures.md (#224)
* Update lifetimes-data-structures.md

The example is quite simple, but in it's simplicity it may raise the question why do we even need lifetimes in the structs? Isn't it obvious that the referenced value should always outlive the struct? This sentence tries to explain that more complex cases exist.

* Fix typo

Co-authored-by: Andrew Walbran <qwandor@google.com>
2023-01-23 11:37:38 +00:00
Igor Petruk
473fd02be7
Update sizes.md (#228)
Adding more details in how to control Rust enum size and discriminant values.
2023-01-23 11:33:23 +00:00
Igor Petruk
8dd749da60
Update field-shorthand.md (#227)
Introducing `Self` type that students can encounter in many places and nice to use. It is only mentioned later in the course, but it is not defined currently.
2023-01-23 11:32:46 +00:00
Igor Petruk
356d1cec19
Update boot-library.md (#225)
Adding a link to the Solution.
2023-01-23 11:30:52 +00:00
Igor Petruk
820453ba08
Update structs.md (#232)
Extending a struct example that demonstrates how to change values and how to partially copy structs.
2023-01-23 11:26:22 +00:00
Igor Petruk
4c052d33c8
Update borrowing.md (#222) 2023-01-23 11:24:17 +00:00
Igor Petruk
de4aa3de88
Update moves-function-calls.md (#220)
Additional note helps to understand what move really means. The `name` ownership went fully into the `say_hello`.
2023-01-23 11:23:44 +00:00
Igor Petruk
8c58253217
Update the Speaker Notes of the type-inference.md (#214)
* Update the Speaker Notes of the type-inference.md

I think this is one of the critical moments in understanding Rust. This behavior is different from many static and dynamic programming languages.

* Fix typo

Co-authored-by: Andrew Walbran <qwandor@google.com>
2023-01-23 11:05:46 +00:00
Igor Petruk
ec7125da2e
Adding a link to Solutions from for-loops.md and extending the answer to the bonus questions. (#213)
* Update for-loops.md

* Update solutions-morning.md
2023-01-23 11:05:36 +00:00
Igor Petruk
4760295030
Update Speaker Notes for compound-types.md (#207)
It could be a "gotcha" moment for readers when they associate `()` with `void` from, say, C++.
2023-01-23 11:04:38 +00:00
Igor Petruk
dc894b1e9d
Update arc.md (#255)
Adding more information about `Arc`: what it stands for, costs and that reference cycles can occur.
2023-01-23 10:57:10 +00:00
Igor Petruk
8107a0ea2b
Update scoped-threads.md (#253)
Adding speaker notes explaining why scoped threads work and what borrowing rules apply.
2023-01-23 10:56:32 +00:00
Igor Petruk
77a60d4101
Update send-sync.md (#258)
Adding notes that these traits are not to be implemented directly. Yet they are still to be used as normal traits in generic constraints.
2023-01-23 08:51:41 +01:00
Igor Petruk
905d0a067e
Update implicit-conversions.md (#210)
I suggest to clarify that you only need to implement `From` and nobody really implements `Into` as soon as `From` is implemented.

I decided to add a separate paragraph after the `i8` and `i16` example, as they provide intuitive understanding of reverse relationship between `From` and `Into`. Alternatively trying to explain `From` and `Into` in generic way sounds more confusing than just adding this sentence after the specific example.
2023-01-21 14:20:14 +00:00
Igor Petruk
25a32abef7
Update Speaker Notes for compile-time.md (#205)
* Update Speaker Notes for compile-time.md

The definition of memory leaks is indeed blurry, so it is important not have right expectations about this particular kind of error.

Co-authored-by: Martin Geisler <martin@geisler.net>
2023-01-21 15:13:51 +01:00
Igor Petruk
79decc5540
Update Speaker Notes for what-is-rust.md (#204) 2023-01-21 14:10:00 +00:00
Charisee Chiw
d4c0099781
Added speaker notes to enum sizes (#201)
* Added speaker notes to enum sizes

* Update sizes.md

Just formatting

Co-authored-by: Fabian Bornhofen <fbornhofen@google.com>
2023-01-20 22:55:30 +01:00
Martin Geisler
dbc11b2df2
Watch po/ directory for changes (#188)
This makes `mdbook serve` automatically reload the page when
translations change.
2023-01-20 11:36:14 +01:00
Andy George
492037641e
fix Cargo.toml syntax (#190) 2023-01-20 11:28:38 +01:00
Martin Geisler
790e964ee6
Merge pull request #186 from rastringer/patch-1
Speaker notes for 6.5 Functions
2023-01-19 14:48:11 +01:00
Robin Stringer
2d4340f3eb
Speaker notes for 6.5 Functions
Adds speaker notes covering functions basics (declaration parameters, return values, the 'unit' type.
2023-01-19 12:16:43 +00:00
Andrew Walbran
eb9f873466
Merge pull request #185 from markozagar/zagar
Edits to Day1 Morning material
2023-01-19 11:55:12 +00:00
Marko Zagar
6bda89f34e Clarification on references 2023-01-19 10:51:35 +00:00
Marko Zagar
529d4bf20c Speaker note tweaks for compound types 2023-01-19 10:51:35 +00:00
Marko Zagar
7a2ffda266 Mention ADT and zero-cost abstractions among modern features 2023-01-19 10:51:35 +00:00
Martin Geisler
20601319f2
Merge pull request #130 from google/translations
Add support for translations
2023-01-18 16:37:07 +01:00
Martin Geisler
f42c76e6a8 Test that a no-op translation does nothing
This ensures that the full mdbook-xgettext and mdbook-gettext workflow
is stable and doesn’t include spurious newlines.
2023-01-18 16:12:53 +01:00