<!-- Keep first page as index.md to avoid giving it two names. -->

[Welcome to Comprehensive Rust 🦀](index.md)

- [Running the Course](running-the-course.md)
  - [Course Structure](running-the-course/course-structure.md)
  - [Keyboard Shortcuts](running-the-course/keyboard-shortcuts.md)
  - [Translations](running-the-course/translations.md)
- [Using Cargo](cargo.md)
  - [Rust Ecosystem](cargo/rust-ecosystem.md)
  - [Code Samples](cargo/code-samples.md)
  - [Running Cargo Locally](cargo/running-locally.md)

---

# Day 1: Morning

- [Welcome](welcome-day-1.md)
- [Hello, World](hello-world.md)
  - [What is Rust?](hello-world/what-is-rust.md)
  - [Benefits of Rust](hello-world/benefits.md)
  - [Playground](hello-world/playground.md)
- [Types and Values](types-and-values.md)
  - [Hello, World](types-and-values/hello-world.md)
  - [Variables](types-and-values/variables.md)
  - [Values](types-and-values/values.md)
  - [Arithmetic](types-and-values/arithmetic.md)
  - [Type Inference](types-and-values/inference.md)
  - [Exercise: Fibonacci](types-and-values/exercise.md)
    - [Solution](types-and-values/solution.md)
- [Control Flow Basics](control-flow-basics.md)
  - [Blocks and Scopes](control-flow-basics/blocks-and-scopes.md)
  - [`if` Expressions](control-flow-basics/if.md)
  - [`match` Expressions](control-flow-basics/match.md)
  - [Loops](control-flow-basics/loops.md)
    - [`for`](control-flow-basics/loops/for.md)
    - [`loop`](control-flow-basics/loops/loop.md)
  - [`break` and `continue`](control-flow-basics/break-continue.md)
    - [Labels](control-flow-basics/break-continue/labels.md)
  - [Functions](control-flow-basics/functions.md)
  - [Macros](control-flow-basics/macros.md)
  - [Exercise: Collatz Sequence](control-flow-basics/exercise.md)
    - [Solution](control-flow-basics/solution.md)

# Day 1: Afternoon

- [Welcome](welcome-day-1-afternoon.md)
- [Tuples and Arrays](tuples-and-arrays.md)
  - [Arrays](tuples-and-arrays/arrays.md)
  - [Tuples](tuples-and-arrays/tuples.md)
  - [Array Iteration](tuples-and-arrays/iteration.md)
  - [Patterns and Destructuring](tuples-and-arrays/destructuring.md)
  - [Exercise: Nested Arrays](tuples-and-arrays/exercise.md)
    - [Solution](tuples-and-arrays/solution.md)
- [References](references.md)
  - [Shared References](references/shared.md)
  - [Exclusive References](references/exclusive.md)
  - [Slices](references/slices.md)
  - [Strings](references/strings.md)
  - [Reference Validity](references/dangling.md)
  - [Exercise: Geometry](references/exercise.md)
    - [Solution](references/solution.md)
- [User-Defined Types](user-defined-types.md)
  - [Named Structs](user-defined-types/named-structs.md)
  - [Tuple Structs](user-defined-types/tuple-structs.md)
  - [Enums](user-defined-types/enums.md)
  - [Type Aliases](user-defined-types/aliases.md)
  - [Const](user-defined-types/const.md)
  - [Static](user-defined-types/static.md)
  - [Exercise: Elevator Events](user-defined-types/exercise.md)
    - [Solution](user-defined-types/solution.md)

---

# Day 2: Morning

- [Welcome](welcome-day-2.md)
- [Pattern Matching](pattern-matching.md)
  - [Irrefutable Patterns](pattern-matching/infallible.md)
  - [Matching Values](pattern-matching/match.md)
  - [Destructuring Structs](pattern-matching/destructuring-structs.md)
  - [Destructuring Enums](pattern-matching/destructuring-enums.md)
  - [Let Control Flow](pattern-matching/let-control-flow.md)
    - [`if let` Expressions](pattern-matching/let-control-flow/if-let.md)
    - [`while let` Statements](pattern-matching/let-control-flow/while-let.md)
    - [`let else`](pattern-matching/let-control-flow/let-else.md)
  - [Exercise: Expression Evaluation](pattern-matching/exercise.md)
    - [Solution](pattern-matching/solution.md)
- [Methods and Traits](methods-and-traits.md)
  - [Methods](methods-and-traits/methods.md)
  - [Traits](methods-and-traits/traits.md)
    - [Implementing Traits](methods-and-traits/traits/implementing.md)
    - [Supertraits](methods-and-traits/traits/supertraits.md)
    - [Associated Types](methods-and-traits/traits/associated-types.md)
  - [Deriving](methods-and-traits/deriving.md)
  - [Exercise: Generic Logger](methods-and-traits/exercise.md)
    - [Solution](methods-and-traits/solution.md)
- [Generics](generics.md)
  - [Generic Functions](generics/generic-functions.md)
  - [Trait Bounds](generics/trait-bounds.md)
  - [Generic Data Types](generics/generic-data.md)
  - [Generic Traits](generics/generic-traits.md)
  - [`impl Trait`](generics/impl-trait.md)
  - [`dyn Trait`](generics/dyn-trait.md)
  - [Exercise: Generic `min`](generics/exercise.md)
    - [Solution](generics/solution.md)

# Day 2: Afternoon

- [Welcome](welcome-day-2-afternoon.md)
- [Standard Library Types](std-types.md)
  - [Standard Library](std-types/std.md)
  - [Documentation](std-types/docs.md)
  - [`Option`](std-types/option.md)
  - [`Result`](std-types/result.md)
  - [`String`](std-types/string.md)
  - [`Vec`](std-types/vec.md)
  - [`HashMap`](std-types/hashmap.md)
  - [Exercise: Counter](std-types/exercise.md)
    - [Solution](std-types/solution.md)
- [Closures](closures.md)
  - [Closure Syntax](closures/syntax.md)
  - [Capturing](closures/capturing.md)
  - [Closure Traits](closures/traits.md)
  - [Exercise: Log Filter](closures/exercise.md)
    - [Solution](closures/solution.md)
- [Standard Library Traits](std-traits.md)
  - [Comparisons](std-traits/comparisons.md)
  - [Operators](std-traits/operators.md)
  - [`From` and `Into`](std-traits/from-and-into.md)
  - [Casting](std-traits/casting.md)
  - [`Read` and `Write`](std-traits/read-and-write.md)
  - [`Default`, struct update syntax](std-traits/default.md)
  - [Exercise: ROT13](std-traits/exercise.md)
    - [Solution](std-traits/solution.md)

---

# Day 3: Morning

- [Welcome](welcome-day-3.md)
- [Memory Management](memory-management.md)
  - [Review of Program Memory](memory-management/review.md)
  - [Approaches to Memory Management](memory-management/approaches.md)
  - [Ownership](memory-management/ownership.md)
  - [Move Semantics](memory-management/move.md)
  - [`Clone`](memory-management/clone.md)
  - [Copy Types](memory-management/copy-types.md)
  - [`Drop`](memory-management/drop.md)
  - [Exercise: Builder Type](memory-management/exercise.md)
    - [Solution](memory-management/solution.md)
- [Smart Pointers](smart-pointers.md)
  - [`Box<T>`](smart-pointers/box.md)
  - [`Rc`](smart-pointers/rc.md)
  - [Owned Trait Objects](smart-pointers/trait-objects.md)
  - [Exercise: Binary Tree](smart-pointers/exercise.md)
    - [Solution](smart-pointers/solution.md)

# Day 3: Afternoon

- [Welcome](welcome-day-3-afternoon.md)
- [Borrowing](borrowing.md)
  - [Borrowing a Value](borrowing/shared.md)
  - [Borrow Checking](borrowing/borrowck.md)
  - [Borrow Errors](borrowing/examples.md)
  - [Interior Mutability](borrowing/interior-mutability.md)
    - [`Cell`](borrowing/interior-mutability/cell.md)
    - [`RefCell`](borrowing/interior-mutability/refcell.md)
  - [Exercise: Health Statistics](borrowing/exercise.md)
    - [Solution](borrowing/solution.md)
- [Lifetimes](lifetimes.md)
  - [Lifetime Annotations](lifetimes/lifetime-annotations.md)
  - [Lifetime Elision](lifetimes/lifetime-elision.md)
  - [Lifetimes in Data Structures](lifetimes/struct-lifetimes.md)
  - [Exercise: Protobuf Parsing](lifetimes/exercise.md)
    - [Solution](lifetimes/solution.md)

---

# Day 4: Morning

- [Welcome](welcome-day-4.md)
- [Iterators](iterators.md)
  - [Motivation](iterators/motivation.md)
  - [`Iterator` Trait](iterators/iterator.md)
  - [`Iterator` Helper Methods](iterators/helpers.md)
  - [`collect`](iterators/collect.md)
  - [`IntoIterator`](iterators/intoiterator.md)
  - [Exercise: Iterator Method Chaining](iterators/exercise.md)
    - [Solution](iterators/solution.md)
- [Modules](modules.md)
  - [Modules](modules/modules.md)
  - [Filesystem Hierarchy](modules/filesystem.md)
  - [Visibility](modules/visibility.md)
  - [Encapsulation](modules/encapsulation.md)
  - [`use`, `super`, `self`](modules/paths.md)
  - [Exercise: Modules for a GUI Library](modules/exercise.md)
    - [Solution](modules/solution.md)
- [Testing](testing.md)
  - [Unit Tests](testing/unit-tests.md)
  - [Other Types of Tests](testing/other.md)
  - [Compiler Lints and Clippy](testing/lints.md)
  - [Exercise: Luhn Algorithm](testing/exercise.md)
    - [Solution](testing/solution.md)

# Day 4: Afternoon

- [Welcome](welcome-day-4-afternoon.md)
- [Error Handling](error-handling.md)
  - [Panics](error-handling/panics.md)
  - [`Result`](error-handling/result.md)
  - [Try Operator](error-handling/try.md)
  - [Try Conversions](error-handling/try-conversions.md)
  - [`Error` Trait](error-handling/error.md)
  - [`thiserror`](error-handling/thiserror.md)
  - [`anyhow`](error-handling/anyhow.md)
  - [Exercise: Rewriting with `Result`](error-handling/exercise.md)
    - [Solution](error-handling/solution.md)
- [Unsafe Rust](unsafe-rust.md)
  - [Unsafe](unsafe-rust/unsafe.md)
  - [Dereferencing Raw Pointers](unsafe-rust/dereferencing.md)
  - [Mutable Static Variables](unsafe-rust/mutable-static.md)
  - [Unions](unsafe-rust/unions.md)
  - [Unsafe Functions](unsafe-rust/unsafe-functions.md)
    - [Unsafe Rust Functions](unsafe-rust/unsafe-functions/rust.md)
    - [Unsafe External Functions](unsafe-rust/unsafe-functions/extern-c.md)
    - [Calling Unsafe Functions](unsafe-rust/unsafe-functions/calling.md)
  - [Unsafe Traits](unsafe-rust/unsafe-traits.md)
  - [Exercise: FFI Wrapper](unsafe-rust/exercise.md)
    - [Solution](unsafe-rust/solution.md)

---

# Android

- [Welcome](android.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)
  - [Birthday Service Tutorial](android/aidl/birthday-service.md)
    - [Interface](android/aidl/example-service/interface.md)
    - [Service API](android/aidl/example-service/service-bindings.md)
    - [Service](android/aidl/example-service/service.md)
    - [Server](android/aidl/example-service/server.md)
    - [Deploy](android/aidl/example-service/deploy.md)
    - [Client](android/aidl/example-service/client.md)
    - [Changing API](android/aidl/example-service/changing-definition.md)
    - [Updating Implementations](android/aidl/example-service/changing-implementation.md)
  - [AIDL Types](android/aidl/types.md)
    - [Primitive Types](android/aidl/types/primitives.md)
    - [Array Types](android/aidl/types/arrays.md)
    - [Sending Objects](android/aidl/types/objects.md)
    - [Parcelables](android/aidl/types/parcelables.md)
    - [Sending Files](android/aidl/types/file-descriptor.md)
- [Testing](android/testing.md)
  - [GoogleTest](android/testing/googletest.md)
  - [Mocking](android/testing/mocking.md)
- [Logging](android/logging.md)
- [Interoperability](android/interoperability.md)
  - [With C](android/interoperability/with-c.md)
    - [A Simple C Library](android/interoperability/with-c/c-library.md)
    - [Bindgen](android/interoperability/with-c/bindgen.md)
    - [Running Our Binary](android/interoperability/with-c/run-our-binary.md)
    - [A Simple Rust Library](android/interoperability/with-c/rust-library.md)
    - [Calling Rust from C](android/interoperability/with-c/rust.md)
  - [With C++](android/interoperability/cpp.md)
    - [The Bridge Module](android/interoperability/cpp/bridge.md)
    - [Rust Bridge](android/interoperability/cpp/rust-bridge.md)
    - [Generated C++](android/interoperability/cpp/generated-cpp.md)
    - [C++ Bridge](android/interoperability/cpp/cpp-bridge.md)
    - [Shared Types](android/interoperability/cpp/shared-types.md)
    - [Shared Enums](android/interoperability/cpp/shared-enums.md)
    - [Rust Error Handling](android/interoperability/cpp/rust-result.md)
    - [C++ Error Handling](android/interoperability/cpp/cpp-exception.md)
    - [Additional Types](android/interoperability/cpp/type-mapping.md)
    - [Building for Android: Genrules](android/interoperability/cpp/android-cpp-genrules.md)
    - [Building for Android: C++](android/interoperability/cpp/android-build-cpp.md)
    - [Building for Android: Rust](android/interoperability/cpp/android-build-rust.md)
  - [With Java](android/interoperability/java.md)

---

# Chromium

- [Welcome](chromium.md)
- [Setup](chromium/setup.md)
- [Comparing Chromium and Cargo Ecosystems](chromium/cargo.md)
- [Policy](chromium/policy.md)
- [Build Rules](chromium/build-rules.md)
  - [Unsafe Code](chromium/build-rules/unsafe.md)
  - [Depending on Rust Code from Chromium C++](chromium/build-rules/depending.md)
  - [Visual Studio Code](chromium/build-rules/vscode.md)
  - [Exercise](exercises/chromium/build-rules.md)
- [Testing](chromium/testing.md)
  - [`rust_gtest_interop` Library](chromium/testing/rust-gtest-interop.md)
  - [GN Rules for Rust Tests](chromium/testing/build-gn.md)
  - [`chromium::import!` Macro](chromium/testing/chromium-import-macro.md)
  - [Exercise](exercises/chromium/testing.md)
- [Interoperability with C++](chromium/interoperability-with-cpp.md)
  - [Example Bindings](chromium/interoperability-with-cpp/example-bindings.md)
  - [Limitations of CXX](chromium/interoperability-with-cpp/limitations-of-cxx.md)
  - [CXX Error Handling](chromium/interoperability-with-cpp/error-handling.md)
    - [Error Handling: QR Example](chromium/interoperability-with-cpp/error-handling-qr.md)
    - [Error Handling: PNG Example](chromium/interoperability-with-cpp/error-handling-png.md)
  - [Using CXX in Chromium](chromium/interoperability-with-cpp/using-cxx-in-chromium.md)
  - [Exercise](exercises/chromium/interoperability-with-cpp.md)
- [Adding Third Party Crates](chromium/adding-third-party-crates.md)
  - [Configuring Cargo.toml](chromium/adding-third-party-crates/configuring-cargo-toml.md)
  - [Configuring `gnrt_config.toml`](chromium/adding-third-party-crates/configuring-gnrt-config-toml.md)
  - [Downloading Crates](chromium/adding-third-party-crates/downloading-crates.md)
  - [Generating `gn` Build Rules](chromium/adding-third-party-crates/generating-gn-build-rules.md)
  - [Resolving Problems](chromium/adding-third-party-crates/resolving-problems.md)
    - [Build Scripts Which Generate Code](chromium/adding-third-party-crates/resolving-problems/build-scripts-which-generate-code.md)
    - [Build Scripts Which Build C++ or Take Arbitrary Actions](chromium/adding-third-party-crates/resolving-problems/build-scripts-which-take-arbitrary-actions.md)
  - [Depending on a Crate](chromium/adding-third-party-crates/depending-on-a-crate.md)
  - [Reviews and Audits](chromium/adding-third-party-crates/reviews-and-audits.md)
  - [Checking into Chromium Source Code](chromium/adding-third-party-crates/checking-in.md)
  - [Keeping Crates Up to Date](chromium/adding-third-party-crates/keeping-up-to-date.md)
  - [Exercise](exercises/chromium/third-party.md)
- [Bringing It Together - Exercise](exercises/chromium/bringing-it-together.md)
- [Exercise Solutions](exercises/chromium/solutions.md)

---

# Bare Metal: Morning

- [Welcome](bare-metal.md)
- [`no_std`](bare-metal/no_std.md)
  - [A Minimal Example](bare-metal/minimal.md)
  - [`alloc`](bare-metal/alloc.md)
- [Microcontrollers](bare-metal/microcontrollers.md)
  - [Raw MMIO](bare-metal/microcontrollers/mmio.md)
  - [PACs](bare-metal/microcontrollers/pacs.md)
  - [HAL Crates](bare-metal/microcontrollers/hals.md)
  - [Board Support Crates](bare-metal/microcontrollers/board-support.md)
  - [The Type State Pattern](bare-metal/microcontrollers/type-state.md)
  - [`embedded-hal`](bare-metal/microcontrollers/embedded-hal.md)
  - [`probe-rs` and `cargo-embed`](bare-metal/microcontrollers/probe-rs.md)
    - [Debugging](bare-metal/microcontrollers/debugging.md)
  - [Other Projects](bare-metal/microcontrollers/other-projects.md)
- [Exercises](exercises/bare-metal/morning.md)
  - [Compass](exercises/bare-metal/compass.md)
  - [Solutions](exercises/bare-metal/solutions-morning.md)

# Bare Metal: Afternoon

- [Application Processors](bare-metal/aps.md)
  - [Getting Ready to Rust](bare-metal/aps/entry-point.md)
  - [Inline Assembly](bare-metal/aps/inline-assembly.md)
  - [MMIO](bare-metal/aps/mmio.md)
  - [Let's Write a UART Driver](bare-metal/aps/uart.md)
    - [More Traits](bare-metal/aps/uart/traits.md)
    - [Using It](bare-metal/aps/uart/using.md)
  - [A Better UART Driver](bare-metal/aps/better-uart.md)
    - [Bitflags](bare-metal/aps/better-uart/bitflags.md)
    - [Multiple Registers](bare-metal/aps/better-uart/registers.md)
    - [Driver](bare-metal/aps/better-uart/driver.md)
  - [safe-mmio](bare-metal/aps/safemmio/registers.md)
    - [Driver](bare-metal/aps/safemmio/driver.md)
    - [Using It](bare-metal/aps/safemmio/using.md)
  - [Logging](bare-metal/aps/logging.md)
    - [Using It](bare-metal/aps/logging/using.md)
  - [Exceptions](bare-metal/aps/exceptions.md)
  - [aarch64-rt](bare-metal/aps/aarch64-rt.md)
  - [Other Projects](bare-metal/aps/other-projects.md)
- [Useful Crates](bare-metal/useful-crates.md)
  - [`zerocopy`](bare-metal/useful-crates/zerocopy.md)
  - [`aarch64-paging`](bare-metal/useful-crates/aarch64-paging.md)
  - [`buddy_system_allocator`](bare-metal/useful-crates/buddy_system_allocator.md)
  - [`tinyvec`](bare-metal/useful-crates/tinyvec.md)
  - [`spin`](bare-metal/useful-crates/spin.md)
- [Bare-Metal on Android](bare-metal/android.md)
  - [`vmbase`](bare-metal/android/vmbase.md)
- [Exercises](exercises/bare-metal/afternoon.md)
  - [RTC Driver](exercises/bare-metal/rtc.md)
  - [Solutions](exercises/bare-metal/solutions-afternoon.md)

---

# Concurrency: Morning

- [Welcome](concurrency/welcome.md)
- [Threads](concurrency/threads.md)
  - [Plain Threads](concurrency/threads/plain.md)
  - [Scoped Threads](concurrency/threads/scoped.md)
- [Channels](concurrency/channels.md)
  - [Senders and Receivers](concurrency/channels/senders-receivers.md)
  - [Unbounded Channels](concurrency/channels/unbounded.md)
  - [Bounded Channels](concurrency/channels/bounded.md)
- [`Send` and `Sync`](concurrency/send-sync.md)
  - [Marker Traits](concurrency/send-sync/marker-traits.md)
  - [`Send`](concurrency/send-sync/send.md)
  - [`Sync`](concurrency/send-sync/sync.md)
  - [Examples](concurrency/send-sync/examples.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)
- [Exercises](concurrency/sync-exercises.md)
  - [Dining Philosophers](concurrency/sync-exercises/dining-philosophers.md)
  - [Multi-threaded Link Checker](concurrency/sync-exercises/link-checker.md)
  - [Solutions](concurrency/sync-exercises/solutions.md)

# Concurrency: Afternoon

- [Welcome](concurrency/welcome-async.md)
- [Async Basics](concurrency/async.md)
  - [`async`/`await`](concurrency/async/async-await.md)
  - [Futures](concurrency/async/futures.md)
  - [State Machine](concurrency/async/state-machine.md)
  - [Runtimes](concurrency/async/runtimes.md)
    - [Tokio](concurrency/async/runtimes/tokio.md)
  - [Tasks](concurrency/async/tasks.md)
- [Channels and Control Flow](concurrency/async-control-flow.md)
  - [Async Channels](concurrency/async-control-flow/channels.md)
  - [Join](concurrency/async-control-flow/join.md)
  - [Select](concurrency/async-control-flow/select.md)
- [Pitfalls](concurrency/async-pitfalls.md)
  - [Blocking the Executor](concurrency/async-pitfalls/blocking-executor.md)
  - [`Pin`](concurrency/async-pitfalls/pin.md)
  - [Async Traits](concurrency/async-pitfalls/async-traits.md)
  - [Cancellation](concurrency/async-pitfalls/cancellation.md)
- [Exercises](concurrency/async-exercises.md)
  - [Dining Philosophers](concurrency/async-exercises/dining-philosophers.md)
  - [Broadcast Chat Application](concurrency/async-exercises/chat-app.md)
  - [Solutions](concurrency/async-exercises/solutions.md)

---

# Idiomatic Rust

- [Welcome](idiomatic/welcome.md)
- [Leveraging the Type System](idiomatic/leveraging-the-type-system.md)
  - [Newtype Pattern](idiomatic/leveraging-the-type-system/newtype-pattern.md)
    - [Semantic Confusion](idiomatic/leveraging-the-type-system/newtype-pattern/semantic-confusion.md)
    - [Parse, Don't Validate](idiomatic/leveraging-the-type-system/newtype-pattern/parse-don-t-validate.md)
    - [Is It Encapsulated?](idiomatic/leveraging-the-type-system/newtype-pattern/is-it-encapsulated.md)
  - [Typestate Pattern](idiomatic/leveraging-the-type-system/typestate-pattern.md)
    - [Typestate Pattern with Generics](idiomatic/leveraging-the-type-system/typestate-pattern/typestate-generics.md)

---

# Unsafe

- [Welcome](unsafe-deep-dive/welcome.md)
- [Setup](unsafe-deep-dive/setup.md)
- [Motivations](unsafe-deep-dive/motivations.md)
  - [Interoperability](unsafe-deep-dive/motivations/interop.md)
  - [Data Structures](unsafe-deep-dive/motivations/data-structures.md)
  - [Performance](unsafe-deep-dive/motivations/performance.md)
- [Foundations](unsafe-deep-dive/foundations.md)
  - [What is unsafe?](unsafe-deep-dive/foundations/what-is-unsafe.md)
  - [When is unsafe used?](unsafe-deep-dive/foundations/when-is-unsafe-used.md)
  - [Data structures are safe](unsafe-deep-dive/foundations/data-structures-are-safe.md)
  - [Actions might not be](unsafe-deep-dive/foundations/actions-might-not-be.md)
  - [Less powerful than it seems](unsafe-deep-dive/foundations/less-powerful.md)

---

# Final Words

- [Thanks!](thanks.md)
- [Glossary](glossary.md)
- [Other Resources](other-resources.md)
- [Credits](credits.md)
