1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-24 07:21:05 +02:00

23 Commits

Author SHA1 Message Date
Nicole L
e902b1ef60
Add a slide on match to control flow section (#2515) 2024-12-17 12:08:42 -08:00
Martin Geisler
be476391f2
Add speaker notes to flow control basics (#2498)
Part of #1083.
2024-12-06 12:46:35 +01:00
Nicole L
2f9babd098
Miscellaneous minor improvements (#2370) 2024-09-20 14:19:53 -07:00
Lalit Shankar Chowdhury
45f869902b
Clarify and fix grammatical errors (#2347)
Fix minor grammatical errors in Day 1: Morning.

Speaker notes 6.5: "the `-> ()` return type" changed to "the return
type".

The compiler will infer the unit type for any type omitted.
2024-09-04 18:54:14 +00:00
Jason Lin
590a88fc3d
update break-continue.md (#2287)
Move the speak note about "loop" into the page which we actually talk
about "loop". Also update the wording to make it more accurate.

---------

Co-authored-by: Jason Lin <lxj@google.com>
2024-08-21 06:33:50 +00:00
Jason Lin
4012e2a883
Update if.md (#2286)
The original phrasing may imply that you have to always terminated a
`if` expression with `;`. But the real reason that we have to do that is
because we are using it in a `let` statement here, and `let` statement
has to be terminated by `;`

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2024-08-20 08:15:39 +00:00
Frances Wingerter
fa6055c297
break/continue: don't say "for loop" (#2277)
See #2042.
2024-08-13 14:27:08 +00:00
Dustin J. Mitchell
13d69007d4
Clarify speaker note in control-flow-basics (#2102)
Fixes #2096.
2024-05-29 13:08:06 -04:00
Nicole L
5ecdddf9c8
Remove tangential text from if slide (#1840) 2024-02-23 08:53:26 -08:00
Nicole L
d75dd5d681
Flesh out for loop example (#1841)
* Add example of iterating over a collection.
* Update speaker notes to call out the use of iterators.

I think it's useful to call out that `for` loops primarily are used to
iterate over a collection of objects, even though we haven't yet talked
about any concrete collection types at this point. I think using the
array literal syntax is simple enough to understand that it should be
quick to explain when we get to this slide.
2024-02-22 10:49:49 -05:00
Nicole L
9023dd9caa
Tweak timings of exercises to better reflect teaching times (#1839)
A few of the early exercises had much larger estimates than were
actually necessary for the super simple early exercises. I've gone
through and reviewed the time estimates for exercises and tweaked the
estimates based on how much time students have actually needed in my
classes so far.
2024-02-22 10:21:39 -05:00
titong0
8344cbc273
Add missing editable attribute to exercise (#1827)
I was reading the docs and I stumbled upon this.

I'm unsure about when exercises should be solved directly on the site
and when they should be copied and pasted into a playground. But since
the previous chapter's exercise is solvable in the site [(fibonacci
sequence)](0cb7f496b5/src/types-and-values/exercise.md (L15)),

I figured this one might be missing the attribute. Anyway amazing work
on the docs!
2024-02-20 16:12:55 +00:00
Marja Hölttä
f1e4f300ec
Make the "break with label" example more illustrative (#1830)
In the old version, using "break 'outer;" and using "break;" (without
the label) produce the same output.

This version fixes that to make the example more illustrative.

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2024-02-20 10:06:29 +00:00
Manichand Kondapaka
fccdc0d69a
Added blocks and scopes section (#1822) 2024-02-16 13:12:51 -05:00
Manichand Kondapaka
f391e863ab
Added break-continue section. (#1793)
This is a contribution of a break-continue section for Comprehensive
Rust.


![image](https://github.com/google/comprehensive-rust/assets/65899331/e68bf439-bcbd-43c9-88bd-f66470a5956f)

![image](https://github.com/google/comprehensive-rust/assets/65899331/1644a460-8373-4878-b6b9-0ce498e8c95d)

---------

Co-authored-by: Dustin J. Mitchell <dustin@v.igoro.us>
2024-02-15 22:19:06 +00:00
Manichand Kondapaka
345cf646e4
Added loops section (#1789)
This is a contribution of a loops section for Comprehensive Rust.
2024-02-07 19:33:49 +00:00
Dustin J. Mitchell
9f67c9b0e7
Adjust morning-session timings downward (#1786)
Based on feedback from @marshallpierce that mornings took about 2.5
hours, this adjusts a bunch of the morning times downward to try to
match that. In other words, this is trying to make the times in the
course more accurate, rather than reducing the amount of time available
for these slides.

This also updates the `course-schedule` tool to be able to show
per-segment timings.
2024-02-06 15:48:56 -05:00
Andrew Shao
94b517461e
More clarification of blocks (#1706)
I believe it would be helpful to further clarify what delimits a block

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2024-01-16 14:06:24 +00:00
Mike Sandman
f23aa10d32
n1 should be 5, not 15 (#1693) 2024-01-16 11:05:30 +01:00
Karim Ben Amara
3d5bec524f
Fix typo in Control Flow Basics - Macro code snippet (#1638)
Fixes #1637
2024-01-03 14:06:09 +00:00
Martin Geisler
c9f66fd425
Format all Markdown files with dprint (#1157)
This is the result of running `dprint fmt` after removing `src/` from
the list of excluded directories.

This also reformats the Rust code: we might want to tweak this a bit in
the future since some of the changes removes the hand-formatting. Of
course, this formatting can be seen as a mis-feature, so maybe this is
good overall.

Thanks to mdbook-i18n-helpers 0.2, the POT file is nearly unchanged
after this, meaning that all existing translations remain valid! A few
messages were changed because of stray whitespace characters:

     msgid ""
     "Slices always borrow from another object. In this example, `a` has to remain "
    -"'alive' (in scope) for at least as long as our slice. "
    +"'alive' (in scope) for at least as long as our slice."
     msgstr ""

The formatting is enforced in CI and we will have to see how annoying
this is in practice for the many contributors. If it becomes annoying,
we should look into fixing dprint/check#11 so that `dprint` can annotate
the lines that need fixing directly, then I think we can consider more
strict formatting checks.

I added more customization to `rustfmt.toml`. This is to better emulate
the dense style used in the course:

- `max_width = 85` allows lines to take up the full width available in
our code blocks (when taking margins and the line numbers into account).
- `wrap_comments = true` ensures that we don't show very long comments
in the code examples. I edited some comments to shorten them and avoid
unnecessary line breaks — please trim other unnecessarily long comments
when you see them! Remember we're writing code for slides 😄
- `use_small_heuristics = "Max"` allows for things like struct literals
and if-statements to take up the full line width configured above.

The formatting settings apply to all our Rust code right now — I think
we could improve this with https://github.com/dprint/dprint/issues/711
which lets us add per-directory `dprint` configuration files. However,
the `inherit: true` setting is not yet implemented (as far as I can
tell), so a nested configuration file will have to copy most or all of
the top-level file.
2023-12-31 00:15:07 +01:00
Marshall Pierce
6c5061bb90
Various small fixes (#1556)
Plus one more substantial comment on casting.
2023-12-05 18:06:42 -05:00
Dustin J. Mitchell
6d19292f16
Comprehensive Rust v2 (#1073)
I've taken some work by @fw-immunant and others on the new organization
of the course and condensed it into a form amenable to a text editor and
some computational analysis. You can see the inputs in `course.py` but
the interesting bits are the output: `outline.md` and `slides.md`.

The idea is to break the course into more, smaller segments with
exercises at the ends and breaks in between. So `outline.md` lists the
segments, their duration, and sums those durations up per-day. It shows
we're about an hour too long right now! There are more details of the
segments in `slides.md`, or you can see mostly the same stuff in
`course.py`.

This now contains all of the content from the v1 course, ensuring both
that we've covered everything and that we'll have somewhere to redirect
every page.

Fixes #1082.
Fixes #1465.

---------

Co-authored-by: Nicole LeGare <dlegare.1001@gmail.com>
Co-authored-by: Martin Geisler <mgeisler@google.com>
2023-11-29 16:39:24 +01:00