1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-16 14:17:34 +02:00

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
This commit is contained in:
Martin Geisler
2023-05-02 08:02:28 +02:00
committed by GitHub
parent c67922ce8c
commit 3b21053ff2
27 changed files with 164 additions and 154 deletions

View File

@ -4,10 +4,14 @@
[![GitHub contributors](https://img.shields.io/github/contributors/google/comprehensive-rust?style=flat-square)](https://github.com/google/comprehensive-rust/graphs/contributors) [![GitHub contributors](https://img.shields.io/github/contributors/google/comprehensive-rust?style=flat-square)](https://github.com/google/comprehensive-rust/graphs/contributors)
[![GitHub stars](https://img.shields.io/github/stars/google/comprehensive-rust?style=flat-square)](https://github.com/google/comprehensive-rust/stargazers) [![GitHub stars](https://img.shields.io/github/stars/google/comprehensive-rust?style=flat-square)](https://github.com/google/comprehensive-rust/stargazers)
This repository has the source code for Comprehensive Rust 🦀, a four day Rust This repository has the source code for Comprehensive Rust 🦀, a multi-day Rust
course developed by the Android team. The course covers all aspects of Rust, course developed by the Android team. The course covers all aspects of Rust,
from basic syntax to generics and error handling. It also includes from basic syntax to generics and error handling. It also includes deep dives on
Android-specific content on the last day. [Android], [bare-metal], and [concurrency].
[Android]: https://google.github.io/comprehensive-rust/android.md
[bare-metal]: https://google.github.io/comprehensive-rust/bare-metal.md
[concurrency]: https://google.github.io/comprehensive-rust/concurrency.md
Read the course at **https://google.github.io/comprehensive-rust/**. Read the course at **https://google.github.io/comprehensive-rust/**.

View File

@ -42,12 +42,23 @@ level = 0
editable = true editable = true
[output.html.redirect] [output.html.redirect]
# Redirects in the form of "old-path" = "new-path", where the new path
# is relative to the old path.
"structure.html" = "running-the-course/course-structure.html" "structure.html" = "running-the-course/course-structure.html"
"running-the-course/day-4.html" = "course-structure.html"
"exercises/day-4/afternoon.html" = "exercises/day-4/android.html" "exercises/day-4/afternoon.html" = "exercises/day-4/android.html"
"unsafe/unsafe-functions.html" = "calling-unsafe-functions.html" "unsafe/unsafe-functions.html" = "calling-unsafe-functions.html"
"generics/closures.html" = "traits/closures.html" "generics/closures.html" = "traits/closures.html"
"generics/impl-trait.html" = "traits/impl-trait.html" "generics/impl-trait.html" = "traits/impl-trait.html"
"generics/trait-bounds.html" = "traits/trait-bounds.html" "generics/trait-bounds.html" = "traits/trait-bounds.html"
"welcome-bare-metal.html" = "bare-metal.html"
"welcome-day-4.html" = "concurrency.html"
"exercises/day-4/android.html" = "../android/morning.html"
"exercises/day-4/morning.html" = "../concurrency/morning.html"
"exercises/day-4/solutions-morning.html" = "../concurrency/solutions-morning.html"
"exercises/day-4/dining-philosophers.html" = "../concurrency/dining-philosophers.html"
"exercises/day-4/link-checker.html" = "../concurrency/link-checker.html"
"exercises/day-4/elevator.html" = "../concurrency/elevator.html"
[output.exerciser] [output.exerciser]
output-directory = "comprehensive-rust-exercises" output-directory = "comprehensive-rust-exercises"

View File

@ -3,7 +3,6 @@
[Welcome to Comprehensive Rust 🦀](welcome.md) [Welcome to Comprehensive Rust 🦀](welcome.md)
- [Running the Course](running-the-course.md) - [Running the Course](running-the-course.md)
- [Course Structure](running-the-course/course-structure.md) - [Course Structure](running-the-course/course-structure.md)
- [Day 4](running-the-course/day-4.md)
- [Keyboard Shortcuts](running-the-course/keyboard-shortcuts.md) - [Keyboard Shortcuts](running-the-course/keyboard-shortcuts.md)
- [Translations](running-the-course/translations.md) - [Translations](running-the-course/translations.md)
- [Using Cargo](cargo.md) - [Using Cargo](cargo.md)
@ -178,85 +177,37 @@
- [Safe FFI Wrapper](exercises/day-3/safe-ffi-wrapper.md) - [Safe FFI Wrapper](exercises/day-3/safe-ffi-wrapper.md)
# Day 4: Morning # Android
---- ----
- [Welcome](welcome-day-4.md) - [Welcome](android.md)
- [Concurrency](concurrency.md) - [Setup](android/setup.md)
- [Threads](concurrency/threads.md) - [Build Rules](android/build-rules.md)
- [Scoped Threads](concurrency/scoped-threads.md) - [Binary](android/build-rules/binary.md)
- [Channels](concurrency/channels.md) - [Library](android/build-rules/library.md)
- [Unbounded Channels](concurrency/channels/unbounded.md) - [AIDL](android/aidl.md)
- [Bounded Channels](concurrency/channels/bounded.md) - [Interface](android/aidl/interface.md)
- [Shared State](concurrency/shared_state.md) - [Implementation](android/aidl/implementation.md)
- [Arc](concurrency/shared_state/arc.md) - [Server](android/aidl/server.md)
- [Mutex](concurrency/shared_state/mutex.md) - [Deploy](android/aidl/deploy.md)
- [Example](concurrency/shared_state/example.md) - [Client](android/aidl/client.md)
- [Send and Sync](concurrency/send-sync.md) - [Changing API](android/aidl/changing.md)
- [Send](concurrency/send-sync/send.md) - [Logging](android/logging.md)
- [Sync](concurrency/send-sync/sync.md) - [Interoperability](android/interoperability.md)
- [Examples](concurrency/send-sync/examples.md) - [With C](android/interoperability/with-c.md)
- [Exercises](exercises/day-4/morning.md) - [Calling C with Bindgen](android/interoperability/with-c/bindgen.md)
- [Dining Philosophers](exercises/day-4/dining-philosophers.md) - [Calling Rust from C](android/interoperability/with-c/rust.md)
- [Multi-threaded Link Checker](exercises/day-4/link-checker.md) - [With C++](android/interoperability/cpp.md))
- [With Java](android/interoperability/java.md)
- [Exercises](exercises/android/morning.md)
# Day 4: Afternoon (Android)
# Bare Metal: Morning
---- ----
- [Android](android.md) - [Welcome](bare-metal.md)
- [Setup](android/setup.md)
- [Build Rules](android/build-rules.md)
- [Binary](android/build-rules/binary.md)
- [Library](android/build-rules/library.md)
- [AIDL](android/aidl.md)
- [Interface](android/aidl/interface.md)
- [Implementation](android/aidl/implementation.md)
- [Server](android/aidl/server.md)
- [Deploy](android/aidl/deploy.md)
- [Client](android/aidl/client.md)
- [Changing API](android/aidl/changing.md)
- [Logging](android/logging.md)
- [Interoperability](android/interoperability.md)
- [With C](android/interoperability/with-c.md)
- [Calling C with Bindgen](android/interoperability/with-c/bindgen.md)
- [Calling Rust from C](android/interoperability/with-c/rust.md)
- [With C++](android/interoperability/cpp.md))
- [With Java](android/interoperability/java.md)
- [Exercises](exercises/day-4/android.md)
# Day 4: Afternoon (Async)
----
- [Async Basics](async.md)
- [async/await](async/async-await.md)
- [Futures](async/futures.md)
- [Runtimes](async/runtimes.md)
- [Tokio](async/runtimes/tokio.md)
- [Tasks](async/tasks.md)
- [Async Channels](async/channels.md)
- [Control Flow](async/control-flow.md)
- [Join](async/control-flow/join.md)
- [Select](async/control-flow/select.md)
- [Pitfalls](async/pitfalls.md)
- [Blocking the Executor](async/pitfalls/blocking-executor.md)
- [Pin](async/pitfalls/pin.md)
- [Async Traits](async/pitfalls/async-traits.md)
- [Exercises](exercises/day-4/elevator.md)
# Final Words
- [Thanks!](thanks.md)
- [Other Resources](other-resources.md)
- [Credits](credits.md)
----
# Bare Metal Rust: Morning
- [Welcome](welcome-bare-metal.md)
- [no_std](bare-metal/no_std.md) - [no_std](bare-metal/no_std.md)
- [A Minimal Example](bare-metal/minimal.md) - [A Minimal Example](bare-metal/minimal.md)
- [alloc](bare-metal/alloc.md) - [alloc](bare-metal/alloc.md)
@ -273,7 +224,7 @@
- [Exercises](exercises/bare-metal/morning.md) - [Exercises](exercises/bare-metal/morning.md)
- [Compass](exercises/bare-metal/compass.md) - [Compass](exercises/bare-metal/compass.md)
# Bare Metal Rust: Afternoon # Bare Metal: Afternoon
- [Application Processors](bare-metal/aps.md) - [Application Processors](bare-metal/aps.md)
- [Inline Assembly](bare-metal/aps/inline-assembly.md) - [Inline Assembly](bare-metal/aps/inline-assembly.md)
@ -299,7 +250,56 @@
- [Exercises](exercises/bare-metal/afternoon.md) - [Exercises](exercises/bare-metal/afternoon.md)
- [RTC Driver](exercises/bare-metal/rtc.md) - [RTC Driver](exercises/bare-metal/rtc.md)
---
# Concurrency: Morning
----
- [Welcome](concurrency.md)
- [Threads](concurrency/threads.md)
- [Scoped Threads](concurrency/scoped-threads.md)
- [Channels](concurrency/channels.md)
- [Unbounded Channels](concurrency/channels/unbounded.md)
- [Bounded Channels](concurrency/channels/bounded.md)
- [Shared State](concurrency/shared_state.md)
- [Arc](concurrency/shared_state/arc.md)
- [Mutex](concurrency/shared_state/mutex.md)
- [Example](concurrency/shared_state/example.md)
- [Send and Sync](concurrency/send-sync.md)
- [Send](concurrency/send-sync/send.md)
- [Sync](concurrency/send-sync/sync.md)
- [Examples](concurrency/send-sync/examples.md)
- [Exercises](exercises/concurrency/morning.md)
- [Dining Philosophers](exercises/concurrency/dining-philosophers.md)
- [Multi-threaded Link Checker](exercises/concurrency/link-checker.md)
# Concurrency: Afternoon
- [Async Basics](async.md)
- [async/await](async/async-await.md)
- [Futures](async/futures.md)
- [Runtimes](async/runtimes.md)
- [Tokio](async/runtimes/tokio.md)
- [Tasks](async/tasks.md)
- [Async Channels](async/channels.md)
- [Control Flow](async/control-flow.md)
- [Join](async/control-flow/join.md)
- [Select](async/control-flow/select.md)
- [Pitfalls](async/pitfalls.md)
- [Blocking the Executor](async/pitfalls/blocking-executor.md)
- [Pin](async/pitfalls/pin.md)
- [Async Traits](async/pitfalls/async-traits.md)
- [Exercises](exercises/concurrency/elevator.md)
# Final Words
----
- [Thanks!](thanks.md)
- [Other Resources](other-resources.md)
- [Credits](credits.md)
# Solutions # Solutions
@ -312,6 +312,6 @@
- [Day 2 Afternoon](exercises/day-2/solutions-afternoon.md) - [Day 2 Afternoon](exercises/day-2/solutions-afternoon.md)
- [Day 3 Morning](exercises/day-3/solutions-morning.md) - [Day 3 Morning](exercises/day-3/solutions-morning.md)
- [Day 3 Afternoon](exercises/day-3/solutions-afternoon.md) - [Day 3 Afternoon](exercises/day-3/solutions-afternoon.md)
- [Day 4 Morning](exercises/day-4/solutions-morning.md)
- [Bare Metal Rust Morning](exercises/bare-metal/solutions-morning.md) - [Bare Metal Rust Morning](exercises/bare-metal/solutions-morning.md)
- [Bare Metal Rust Afternoon](exercises/bare-metal/solutions-afternoon.md) - [Bare Metal Rust Afternoon](exercises/bare-metal/solutions-afternoon.md)
- [Concurrency Morning](exercises/concurrency/solutions-morning.md)

View File

@ -1,4 +1,4 @@
# Android # Welcome to Rust in Android
Rust is supported for native platform development on Android. This means that Rust is supported for native platform development on Android. This means that
you can write new operating system services in Rust, as well as extending you can write new operating system services in Rust, as well as extending

View File

@ -1,4 +1,4 @@
# Fearless Concurrency # Welcome to Concurrency in Rust
Rust has full support for concurrency using OS threads with mutexes and Rust has full support for concurrency using OS threads with mutexes and
channels. channels.

View File

@ -34,11 +34,11 @@ path = "day-3/simple-gui.rs"
[[bin]] [[bin]]
name = "dining-philosophers" name = "dining-philosophers"
path = "day-4/dining-philosophers.rs" path = "concurrency/dining-philosophers.rs"
[[bin]] [[bin]]
name = "link-checker" name = "link-checker"
path = "day-4/link-checker.rs" path = "concurrency/link-checker.rs"
[dependencies] [dependencies]
reqwest = { version = "0.11.12", features = ["blocking"] } reqwest = { version = "0.11.12", features = ["blocking"] }

View File

@ -1,7 +1,7 @@
# Exercises # Exercises
For the last exercise, we will look at one of the projects you work with. Let us This is a group exercise: We will look at one of the projects you work with and
group up and do this together. Some suggestions: try to integrate some Rust into it. Some suggestions:
* Call your AIDL service with a client written in Rust. * Call your AIDL service with a client written in Rust.

View File

@ -1,4 +1,4 @@
# Day 4 Morning Exercise # Concurrency Morning Exercise
## Dining Philosophers ## Dining Philosophers

View File

@ -1 +0,0 @@
# Exercises

View File

@ -17,7 +17,7 @@ Before you run the course, you will want to:
the audience you expect, or on your own expertise. the audience you expect, or on your own expertise.
1. Decide on the dates. Since the course is large, we recommend that you 1. Decide on the dates. Since the course is large, we recommend that you
schedule the four days over two weeks. Course participants have said that schedule the days over two weeks. Course participants have said that
they find it helpful to have a gap in the course since it helps them process they find it helpful to have a gap in the course since it helps them process
all the information we give them. all the information we give them.
@ -41,8 +41,6 @@ Before you run the course, you will want to:
and offer a solution, e.g., by showing people where to find the relevant and offer a solution, e.g., by showing people where to find the relevant
information in the standard library. information in the standard library.
1. Prepare anything you need to have available for the afternoon of day 4.
That is all, good luck running the course! We hope it will be as much fun for That is all, good luck running the course! We hope it will be as much fun for
you as it has been for us! you as it has been for us!

View File

@ -7,7 +7,56 @@ The course is fast paced and covers a lot of ground:
* Day 1: Basic Rust, ownership and the borrow checker. * Day 1: Basic Rust, ownership and the borrow checker.
* Day 2: Compound data types, pattern matching, the standard library. * Day 2: Compound data types, pattern matching, the standard library.
* Day 3: Traits and generics, error handling, testing, unsafe Rust. * Day 3: Traits and generics, error handling, testing, unsafe Rust.
* Day 4: Concurrency in Rust and seeing Rust in action.
## Deep Dives
In addition to the 3-day class on Rust Fundamentals, we cover some more
specialized topics:
### Android
The [Android Deep Dive](../android.md) is a half-day course on using Rust for
Android platform development. This includes interoperability wtih C, C++, and
Java.
You will need an [AOSP checkout][1]. Make a checkout of the [course
repository][2] on the same machine and move the `src/android/` directory into
the root of your AOSP checkout. This will ensure that the Android build system
sees the `Android.bp` files in `src/android/`.
Ensure that `adb sync` works with your emulator or real device and pre-build all
Android examples using `src/android/build_all.sh`. Read the script to see the
commands it runs and make sure they work when you run them by hand.
[1]: https://source.android.com/docs/setup/download/downloading
[2]: https://github.com/google/comprehensive-rust
### Bare-Metal
The [Bare-Metal Deep Dive](../bare-metal.md): a full day class on using Rust for
bare-metal (embedded) development. Both microcontrollers and application
processors are covered.
For the microcontroller part, you will need to buy the [BBC
micro:bit](https://microbit.org/) v2 development board ahead of time. Everybody
will need to install a number of packages as described on the [welcome
page](../bare-metal.md).
### Concurrency
The [Concurrency Deep Dive](../concurrency.md) is a full day class on classical
as well as `async`/`await` concurrency.
You will need a fresh crate set up and the dependencies downloaded and ready to
go. You can then copy/paste the examples into `src/main.rs` to experiment with
them:
```shell
cargo init concurrency
cd concurrency
cargo add tokio --features full
cargo run
```
## Format ## Format

View File

@ -1,40 +0,0 @@
# Day 4
> This page is for the course instructor.
The afternoon of the fourth day should cover a topic of your choice. Include
the topic in the announcement of the course, so that participants know what to
expect.
This phase of the course is a chance for participants to see Rust in action on a
codebase they might be familiar with. You can choose from the topics already
defined here, or plan your own.
Some topics need additional preparation:
## Android
If you chose Android for Day 4 afternoon, you will need an [AOSP checkout][1].
Make a checkout of the [course repository][2] on the same machine and move the
`src/android/` directory into the root of your AOSP checkout. This will ensure
that the Android build system sees the `Android.bp` files in `src/android/`.
Ensure that `adb sync` works with your emulator or real device and pre-build
all Android examples using `src/android/build_all.sh`. Read the script to see
the commands it runs and make sure they work when you run them by hand.
## Async
If you chose Async for Day 4 afternoon, you will need a fresh crate set up and
the dependencies downloaded and ready to go. You can then copy/paste the
examples into `src/main.rs` to experiment with them.
```shell
cargo init day4
cd day4
cargo add tokio --features full
cargo run
```
[1]: https://source.android.com/docs/setup/download/downloading
[2]: https://github.com/google/comprehensive-rust

View File

@ -1,11 +0,0 @@
# Welcome to Day 4
This morning, we will focus on Concurrency: threads, channels, shared state, `Send` and `Sync`.
In the afternoon, we will have a chance to see Rust in action.
<details>
This is a good time to give an outline of what you will cover in the afternoon
section, as announced in the course offering.
</details>

View File

@ -4,7 +4,7 @@
[![GitHub contributors](https://img.shields.io/github/contributors/google/comprehensive-rust?style=flat-square)](https://github.com/google/comprehensive-rust/graphs/contributors) [![GitHub contributors](https://img.shields.io/github/contributors/google/comprehensive-rust?style=flat-square)](https://github.com/google/comprehensive-rust/graphs/contributors)
[![GitHub stars](https://img.shields.io/github/stars/google/comprehensive-rust?style=flat-square)](https://github.com/google/comprehensive-rust/stargazers) [![GitHub stars](https://img.shields.io/github/stars/google/comprehensive-rust?style=flat-square)](https://github.com/google/comprehensive-rust/stargazers)
This is a four day Rust course developed by the Android team. The course covers This is a three day Rust course developed by the Android team. The course covers
the full spectrum of Rust, from basic syntax to advanced topics like generics the full spectrum of Rust, from basic syntax to advanced topics like generics
and error handling. It also includes Android-specific content on the last day. and error handling. It also includes Android-specific content on the last day.
@ -15,25 +15,25 @@ about Rust and hope to:
* Enable you to modify existing programs and write new programs in Rust. * Enable you to modify existing programs and write new programs in Rust.
* Show you common Rust idioms. * Show you common Rust idioms.
On Day 4, we will cover Android-specific things such as: The first three days show you the fundamentals of Rust. Following this, you're
invited to dive into one or more spezialized topics:
* Building Android components in Rust. * [Android](android.md): a half-day course on using Rust for Android platform
* AIDL servers and clients. development (AOSP). This includes interoperability wtih C, C++, and Java.
* Interoperability with C, C++, and Java. * [Bare-metal](bare-metal.md): a full day class on using Rust for bare-metal
(embedded) development. Both microcontrollers and application processors are
covered.
* [Concurrency](concurrency.md): a full day class on concurrency in Rust. We
cover both classical concurrency (preemptively scheduling using threads and
mutextes) and async/await concurrency (cooperative multitasking using
futures).
It is important to note that this course does not cover Android **application**
development in Rust, and that the Android-specific parts are specifically about
writing code for Android itself, the operating system.
## Non-Goals ## Non-Goals
Rust is a large language and we won't be able to cover all of it in a few days. Rust is a large language and we won't be able to cover all of it in a few days.
Some non-goals of this course are: Some non-goals of this course are:
* Learn how to use async Rust --- we'll only mention async Rust when
covering traditional concurrency primitives. Please see [Asynchronous
Programming in Rust](https://rust-lang.github.io/async-book/) instead for
details on this topic.
* Learn how to develop macros, please see [Chapter 19.5 in the Rust * Learn how to develop macros, please see [Chapter 19.5 in the Rust
Book](https://doc.rust-lang.org/book/ch19-06-macros.html) and [Rust by Book](https://doc.rust-lang.org/book/ch19-06-macros.html) and [Rust by
Example](https://doc.rust-lang.org/rust-by-example/macros.html) instead. Example](https://doc.rust-lang.org/rust-by-example/macros.html) instead.