1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-17 15:21:32 +02:00
Commit Graph

550 Commits

Author SHA1 Message Date
Dustin J. Mitchell
09c996ad96
Move closures to the top level (#604)
move closures to the top level
2023-05-03 09:30:13 -04:00
Martin Geisler
841359f5df
Simplify methods slide (#594)
This tightens the language slightly. I also added a speaker note with
suggestions for more methods to add (if there is time).
2023-05-03 12:01:21 +02:00
Martin Geisler
789abc1028
Wrap comments at 80 columns (#592)
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.
2023-05-03 12:00:58 +02:00
Martin Geisler
4a09d053ac
Simplify fizz buzz slide (#595)
There is no need to introduce `match` here where we don’t have time to
talk about it in detail.
2023-05-03 09:56:58 +02:00
Martin Geisler
3b21053ff2
Cleanup references to "Day 4" (#603)
* 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
2023-05-02 08:02:28 +02:00
Martin Geisler
c67922ce8c
Cleanup control flow slides (#587)
* 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>
2023-04-29 03:12:24 +00:00
Martin Geisler
244e5b99c6
Provide more instructions in the library exercise (#589) 2023-04-29 05:11:12 +02:00
Martin Geisler
fc68829e14
Improve language around ownership of OsString (#602)
Based on discussion in #598.
2023-04-28 10:00:07 +02:00
Martin Geisler
b051b04afa
Use explicit Arc::clone instead of calling .clone() method (#596)
This is to highlight that the clones are cheap: they run custom logic
in the reference counted type, they don’t do a deep clone.
2023-04-27 23:46:09 +02:00
Martin Geisler
6ade739651
Ensure code blocks are editable (#597)
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.
2023-04-27 23:45:41 +02:00
Martin Geisler
5074b1751c
Hint at the list of conversions in FFI exercise (#598)
I see people struggle a lot with guessing why they need to convert
between all these types. The explanations here should help with that.
2023-04-27 23:45:15 +02:00
Martin Geisler
f895ffc5a8
Remove exotic string types from scalar type slide (#593)
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.
2023-04-27 19:57:07 +02:00
Martin Geisler
c0d03bd86b
Consistently use err for the error value (#599) 2023-04-27 19:10:49 +02:00
Andrew Walbran
9d4a34c501
Use smccc crate rather than psci in examples and exercise. (#583)
It was renamed.
2023-04-27 10:54:48 +01:00
John Scheible
c5d15edad4
Direct users to "smccc" crate rather than "psci" (#578)
psci's docs.rs page redirects users to `smccc` instead as the crate has been renamed.
2023-04-26 17:06:28 +01:00
Eric Ye
9187bf0b5e
Add some more hints to the bare-metal RTC exercise (#581)
* 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>
2023-04-25 09:46:37 +01:00
Dustin J. Mitchell
69a62ba227
Add a bit about 'use' (#580)
* Add a bit about 'use'

* fix paths
2023-04-24 18:51:23 +00:00
Dustin J. Mitchell
6744822454
Minor fixes (#579)
* order the Cat and Dog correctly in the vec

* make example editable

* patterns: capture vs. constant

* clarify notes on indexing a string
2023-04-24 14:46:38 -04:00
Andrew Walbran
4266078684
Add pkg-config to list of packages (#575)
pkg-config is also required for the cargo install to work.
2023-04-21 20:29:18 +02:00
Matt Schulte
6a61829d85
Fix safe FFI exercise on macOS (#572)
* Fix safe FFI exercise on macOS

Use the macOS definition of dirent.

Fixes #570

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2023-04-21 03:10:12 +02:00
jaewan-github
e371fd7e54
Main - Fix bug in exercise solution (#569)
* Fix bug in the exercise solution

Window may be nested, so its width should also consider border size.
2023-04-20 18:04:33 +02:00
Andrew Walbran
c5863f6642
Add optional extension to RTC exercise (#562)
* Add methods to mask and clear interrupts.

* Start on GICv3 driver.

* Enable and use RTC interrupt.

* WFI

* Add newtype for interrupt ID.

* Add extension to use interrupt.

* Add method to send an SGI.

* Silence warnings about unused methods in provided drivers.

* Implement Debug manually for IntId.

It's useful to say what kind of interrupt it is.

* Acknowledge and log interrupt.

We should end it as well, but doing so results in a loop unless we first
clear the match.

* cargo fmt with imports_granularity = "module"

* Use arm-gic crate rather than including driver in the example.
2023-04-17 15:38:51 +01:00
Dustin J. Mitchell
d143528e07
Minor fix-ups to the async section. (#566)
These address some comments in #496.
2023-04-16 19:20:24 -04:00
Andrew Walbran
87f1976589
cargo fmt with imports_granularity = "module" (#564) 2023-04-16 20:57:59 +02:00
Dustin J. Mitchell
0d30da7f23
Add an "async" session (#496)
* beginning of an Async section

* address review comments

* Add futures page (#497)

NOTE: `mdbook test` does not allow code samples to reference other crates, so
they must be marked as `compile_fail`; see #175.

* Add Runtimes & Tasks (#522)

These concepts are closely related, and there's not much else to know
about runtimes other than "they exist".

This removes the bit about futures being "inert" because it doesn't
really lead anywhere.

* Async chapter (#524)

* Add async channels chapter

* Async control flow

* Async pitfalls

* Separate in multiple chapters + add daemon section

* Merge reentering threads in blocking-executor

* async_trait

* Async fixes (#546)

* Async: some ideas for simplifying the content (#550)

* Simplify the async-await slide
* Shorten futures and move it up
* Add a page on Tokio

* Modifications to the async section (#556)

* Modifications to the async section

* Remove the "Daemon" slide, as it largely duplicates the "Tasks" slide.
  The introduction to the "Control Flow" section mentions tasks as a
  kind of control flow.

* Reorganize the structure in SUMMARY.md to correspond to the directory
  structure.

* Simplify the "Pin" and "Blocking the Executor" slides with steps in
  the speaker notes to demonstrate / fix the issues.

* Rename "join_all" to "Join".

* Simplify some code samples to shorten them, and to print output rather
  than asserting.

* Clarify speaker notes and include more "Try.." suggestions.

* Be consistent about where `async` blocks are introduced (in the
  "Tasks" slide).

* Explain `join` and `select` in prose.

* Fix formatting of section-header slides.

* Add a note on async trait (#558)

---------

Co-authored-by: sakex <alexandre@senges.ch>
Co-authored-by: rbehjati <razieh@google.com>
2023-04-14 14:06:50 +00:00
Dustin J. Mitchell
6c97e1a7be
Add a new async exercise: elevator simulation. (#557) 2023-04-13 16:26:57 +02:00
Andrew Walbran
d8e442b9cb
Extend bare metal afternoon exercise (#561)
* Add methods to set match register and check whether it matches.

* Add first extension to RTC exercise, using match register.

* No need for constants to be public.
2023-04-13 10:58:06 +01:00
Martin Geisler
5b316b8b5b Prevent accidental publishing the link-checker exercise 2023-04-11 10:47:18 +01:00
Andrew Walbran
bf18b33e39 Use exerciser for day 4 exercises too. 2023-04-11 10:47:18 +01:00
Yuri Astrakhan
5cdb73387f
Inline format vars to make the format str simpler (#551) 2023-04-06 12:00:10 +02:00
Andrew Walbran
86d8c4ae54 Rename exercise template directory and archive. 2023-04-05 16:28:07 +01:00
Andrew Walbran
9375126b3c Use comment rather than inline code to find filename. 2023-04-05 16:28:07 +01:00
Andrew Walbran
c17e8abbd7 Add links to exercise template archive. 2023-04-05 16:28:07 +01:00
Andrew Walbran
b85c893390 Explain entry point and entry.S. 2023-04-05 15:13:10 +01:00
Andrew Walbran
2e94a80d9d Discuss use of unsafe functions and safe wrappers. 2023-04-05 15:13:10 +01:00
Andrew Walbran
5068b1288d Add notes about running examples. 2023-04-05 15:13:10 +01:00
Martin Geisler
907608c504
Format title consistently (#526) 2023-04-04 17:29:33 +02:00
Martin Geisler
a3eaeca212
Update scraper dependency (#547)
* Update scraper dependency to 0.15.0

No code changes required because of this.

* Update dependencies in lock file
2023-04-04 14:27:46 +02:00
dependabot[bot]
64ee862f26
Bump spin from 0.9.6 to 0.9.8 in /src/bare-metal/alloc-example (#544)
Bumps [spin](https://github.com/mvdnes/spin-rs) from 0.9.6 to 0.9.8.
- [Release notes](https://github.com/mvdnes/spin-rs/releases)
- [Changelog](https://github.com/mvdnes/spin-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mvdnes/spin-rs/commits)

---
updated-dependencies:
- dependency-name: spin
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-04 08:54:39 +02:00
dependabot[bot]
4338cd5744
Bump spin from 0.9.6 to 0.9.8 in /src/exercises/bare-metal/rtc (#543)
Bumps [spin](https://github.com/mvdnes/spin-rs) from 0.9.6 to 0.9.8.
- [Release notes](https://github.com/mvdnes/spin-rs/releases)
- [Changelog](https://github.com/mvdnes/spin-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mvdnes/spin-rs/commits)

---
updated-dependencies:
- dependency-name: spin
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-04 08:54:30 +02:00
dependabot[bot]
b32af58a5f
Bump spin from 0.9.5 to 0.9.8 in /src/bare-metal/aps/examples (#542)
Bumps [spin](https://github.com/mvdnes/spin-rs) from 0.9.5 to 0.9.8.
- [Release notes](https://github.com/mvdnes/spin-rs/releases)
- [Changelog](https://github.com/mvdnes/spin-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mvdnes/spin-rs/commits)

---
updated-dependencies:
- dependency-name: spin
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-04 08:54:20 +02:00
Yuri Astrakhan
acf2990243
Update if-let-expressions.md (#540)
* Update if-let-expressions.md

add a note about let-else expressions.  Closes #536

* Remove old mention of let-else

* Indent code block to match the bullet point

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2023-04-03 12:04:26 +02:00
rbehjati
739b3a01e0
Restructure Day-3 morning (#503)
* Restructure Day-3 morning
2023-03-30 13:25:34 +01:00
Dustin J. Mitchell
780368b4f7
Minor fixes for Day 3 Morning (#532)
* don't explain default trait methods early

* talk about Iterator before IntoIterator

* Defer discussion of trait objects to that chapter

* be more specific about turbofish, in speaker notes
2023-03-28 15:42:56 -04:00
Andrew Walbran
8c56c949ef Fix GCC package name. 2023-03-27 17:20:31 +01:00
Andrew Walbran
4427241ca7 cargo-binutils requires llvm-tools-preview 2023-03-27 17:20:31 +01:00
Andrew Walbran
aa1036af66 Add more hints for bare metal morning exercise. 2023-03-27 17:20:31 +01:00
Andrew Walbran
956c137e51 Format hints as bullet-points. 2023-03-27 17:20:31 +01:00
Andrew Walbran
d513109b92 Add Mac OS instructions for picocom too. 2023-03-27 17:20:31 +01:00
Andrew Walbran
6f83b97e69 Fix Markdown formatting. 2023-03-27 17:20:31 +01:00