* Fix solution in Link Checker in Concurrency Morning exercises.
This change fixes the following issues with the current solution:
1. It is not listed on the "solutions" page.
2. It is not multi-threaded and does not use channels.
---------
Co-authored-by: Dustin J. Mitchell <djmitche@google.com>
* compound types: disambiguate that length is not 'same'
* basic syntax: clarify preference for consts and quickly justify unsafety of static mut
* basic-syntax: take review feedback into account on consts/statics
* basic-syntax: be careful not to call `const` defns variables
variables in rust are `place`s in a formal sense and name objects in an informal one; `const` merely abbreviates an expression
* removed $ from code-blocks in build_all.sh
* separate the code from the output
* added shell indicator for the code block
* added shell indicator for the code block
* update logging.md
* separate the code from the output in other files as well
* update the output code-blocks to text
* exercises: health-statistics: weight -> height
weight may be a sensitive topic for some readers; use height instead as this isn't important to the content of the course
* exercises: health-statistics: add health report
this lets us see a non-setter use case for &mut self
it also makes the 'statistics' side of this exercise more explicit as we count doctor visits
* exercises: health-statistics: normalize variable names
* remove $ from code blocks in translations
* remove $ from code blocks in the other markdown files as well
* Revert "remove $ from code blocks in the other markdown files as well"
This reverts commit eda922dab9.
* remove $ from code blocks in setup.md
* re-added the previous changes
* revert logging.md
Outlines an alternative implementation for Polygon::length. This exercise is aimed at novice users and we want to keep the implementation simple. For users familiar with iterator concepts this comment points to an alternative.
* control-flow: blocks: clarify prose around block values/types
specify what determines the type of a block
move the last expression note to the discussion of blocks rather than functions to clarify that it applies to both
* control-flow: if-let: correct sense of 'non-returning'
rename 'designing a library' example
library design in Rust is its own topic that this course does not cover; to avoid confusion, let's stick to describing things in terms of books
In C (as opposed to C++) the explicit cast from void* to int* is not required. It is also not idiomatic to do so in C code.
Actual C codebase would use `malloc()` without the cast, and a C++ one (when not using abstractions) a `new int[n]` - both a bit cleaner and less verbose than this example.
Clarify that each philosopher should think/eat 100 times.
Folks who have hazy memories of the philosopher dining problem may
interpret the original instructions as "make each philosopher think and
eat once". This interpretation loses a critical detail, because the
resulting code is highly unlikely to deadlock in practice, even without
breaking the symmetry.
* Suggest to run day 3 afternoon exercise locally
Based on feedback from running the class, students found developing
the day 3 afternoon exercise locally was a better experience than
using Playground.
* Update src/exercises/day-3/afternoon.md
---------
Co-authored-by: Martin Geisler <martin@geisler.net>
* Run builds on both Mac OS and Linux
This would have helped us catch #570.
* Fix MacOS CI (#848)
* Revert unnecessary changes
The changes might be good, but I want to keep this PR small and
focused. If we end up with the extra `cfg` statements, we should
include a comment to let students know what they do: we’re targeting
people new to Rust, so we need to be careful with explanations.
---------
Co-authored-by: Dominik Maier <domenukk@gmail.com>
* Update default-methods.md
This commit resolves two issues.
a) typo: Equal -> Equals
b) update details to comply w/ example source code
* Update src/traits/default-methods.md
Co-authored-by: Edward Liaw <edliaw@google.com>
---------
Co-authored-by: Martin Geisler <martin@geisler.net>
Co-authored-by: Edward Liaw <edliaw@google.com>
* Add page about entry point before Rust code.
* Convert tabs to spaces.
mdbook doesn't seem to handle tabs in code properly.
* Add page about handling exceptions.
* More nuanced discussion of Rust Raspberry Pi OS tutorial.
* Add note about EL1 to entry point page too.
The link worked fine when GitHub was rendering it — it rewrites the relative path correctly. However, when viewed as the output of `mdbook`, the link pointed to nowhere.
* Mention cancellation via select!
* Add a section on async cancellation
* Update cancellation slide, rework example
* Rework select! note about cancellation
* Collapse cancellation comparision to panic and ?
* Don't keep null bytes from incomplete reads
These translations all have more than 200 translated messages and
they’ve been updated in the last month.
I suggest we update the list here every few weeks based on input from
the translators: we don’t need a super strict rule here, we just need
interested translators who would like to see their work celebrated.
I suggest we only link completed translations in the language picker
since we have limited space there to differentiate the different
levels of completeness.
* Update build_all.sh
The path, $ANDROID_BUILD_TOP and/or $ANDROID_PRODUCT_OUT, can contain spaces, which results in error. As long as shell var is not number, it is safe to enclose it with ""
* Enclose full shell word in quotes
This is just a stylistic choice: I find it easier to parse a command line if the full shell word is in quotes.
---------
Co-authored-by: Martin Geisler <martin@geisler.net>
* Update receiver.md
Moving the sentence to the third point and requesting an example of `self` vs `mut self`.
* Update src/methods/receiver.md
Improved the tone of the sentence.
Co-authored-by: Martin Geisler <martin@geisler.net>
---------
Co-authored-by: Martin Geisler <martin@geisler.net>
Normally developers are aware of the simpler language of implicit vs explicit. By replacing elided with implicit readability of the application might be improved.
Update unbounded.md to address inconsistent code
Fix inconsistency between concurrency `unbounded.md` and `bounded.md` by using implicitly named arguments for both.
* Adds a description of the async chat exercise
* Simplifies the use of Error in chat-async
* Links the solution to the async chat exercise
* Removes the elevator exercise
* Adds dining philosophers as an async exercise
* Adds a solution for async dining philosophers
* Adds a solution page for the afternoon session on concurrency
The Arc/Mutex chapters mention Send/Sync in the speaker notes, and in
fact serve as good illustrations of the traits, so let's define the
traits before referencing them.
* `join!( .., time::sleep(..))` isn't really a "timeout"
* Remove suggestion to make `sleep` take `&mut self`
I'm not sure what doing so demonstrates.
* Update src/async/control-flow/join.md
Co-authored-by: rbehjati <razieh@google.com>
---------
Co-authored-by: rbehjati <razieh@google.com>
When teaching the class, I notice that these comments (which are
wrapped at 100 columns) cause a horizontal scrollbar which makes them
hard to read at a glance.
Here I wrapped them at 80 columns, which fits on the screen and which
avoids overly long lines.
* Align outline with new spin-off course structure
With the new structure, the section on Android is a spin-off course
from the main 3-day course on Rust Fundamentals. The Bare-metal and
Concurrency days are spin-off courses in the same way.
* Explain new course structure
* Align Bare-Metal welcome page with other deep dives
* Merge Day 4 page into Course Structure page
* Remove Day 4 Welcome page
This aligns the Concurrency in Rust section with the Bare-Metal Rust
deep dive.
* Show subsections for Android deep dive
This aligns the Rust in Android section with the other deep dives.
* Clean up welcome page and README
We now cover async Rust and the course is no longer a four day course.
* Remove reference to the old Day 4
* Remove Day 4 references from exercises
* Cleanup control flow slides
This avoids calling all the looping constructs “expressions” since
they all (except for `loop`) return trivial values.
---------
Co-authored-by: Dustin J. Mitchell <djmitche@google.com>
We should default to making code blocks editable: this ensures
consistent syntax highlighting (see #343) and it allows the instructor
to freely edit anything they want.
When teaching the class, I’ve noticed that raw strings and byte
strings tend to cause confusion. The slide is meant to be a friendly
introduction and show how Rust is similar to other languages like C
and C++. Instead, the string types cause a ton of questions which are
unnecessary at this early point.
The information is still there, but now in the form of a speaker note.
* Add some more hints to the bare-metal RTC exercise
I and several others had some difficulties with this part of the problem, especially with regards to knowing where the RTC was wired up and how to fully enable the GIC / interrupts, so add this information to the exercise.
* Remove extra semicolon.
---------
Co-authored-by: Andrew Walbran <qwandor@google.com>