Fixes bug #2004.
Refactored the communication between the speaker notes window and the
regular window by using a Broadcast channel - this is now
self-recovering(!) even if speaker notes are closed and manually
re-opened!
For better readability and maintainability refactored some string-based
states into enum style code and refactored detection of the type of
windows (print, speaker note, regular window)
Manually tested the new code and the speaker notes window does not
disconnect from the regular window anymore.
This now works way more reliable, even if there are (still) some UI
glitches that have been there before already.
Part of #2478 to clean up code blocks when all that is needed is a
trivial debug print statement.
As mentioned in previous related PRs, in some places I've opted to
retain the use of println! because dbg! makes it less readable.
Co-authored-by: Eric Githinji <egithinji@google.com>
Use chopstick to explain why 2 are needed to eat.
Limit async to 2 philosophers so they can deadlock in tokio.
(Tested with [3, 4, 5] philosophers and they all were able to run
without deadlock
with lock ordering disabled.)
---------
Co-authored-by: Sterling Stein <scubed2+git@gmail.com>
Part of #2478 to clean up code blocks when all that is needed is a
trivial debug print statement.
In certain slides (8.1, 9.2, 9.3, 10.5) I've opted to retain the use of
println! because dbg! makes it less readable. The
dbg! macro uses pretty-printing by default and this results in a simple
array such as the one in 8.1 being printed vertically instead of a
cleaner one-liner.
Co-authored-by: Eric Githinji <egithinji@google.com>
As mentioned in #2478, this cleans up the code blocks when all that is
needed is a trivial debug print statement.
Only making changes to Day 1 morning session so that I can get feedback
before proceeding with the rest of the course.
---------
Co-authored-by: Eric Githinji <egithinji@google.com>
The `dbg!` macro, being deployed more widely in #2478, shows the line
number. But if we inject `#![allow(..)]\n` then the printed numbers do
not match those in the textarea. It turns out that `\n` is not required!
cc @egithinji
This is more idiomatic than what we had before.
We keep the trait bounds for the inherent impl, because the new method
can use them to guide inference of unannotated closure arguments.
The content slides all use `fn main`, with the exception of the testing
segment. But with this change, where it makes sense exercises use tests
instead, and not both tests and `fn main`.
A small change in `book.js` supports running tests when a code sample
does not have `fn main` but does have `#[test]`, so these work
naturally.
Fixes#1581.
Change this selector to use the ~= selector to test if a white space
separated word "prev" or "next" is contained
Fixes a speaker notes bug that did not allow going to the next slide in
the speaker notes.
The reason for that is that the "rel" attribute contained "prev"
respective "next prefetch".
See:
https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors#attrvalue_2
This fixes part of #2004 when going to the right (containing
"prefetch").
The speaker notes on the borrowck slide are a bit hard to read since
it's a big block of bulleted points. I've reorganized the notes to be a
bit easier to read by making some of the bullet points nested and by
moving some of the points to the "More to Explore" section. I've also
added a note on re-borrowing since students sometimes ask about it, and
I've added some playground links to demonstrate some of the points.