https://google.github.io/comprehensive-rust/ 1. Welcome to Comprehensive Rust 2. 1. Using Cargo 3. 1. 1.1. Rust Ecosystem 2. 1.2. Code Samples 3. 1.3. Running Cargo Locally 4. 2. Course Structure 5. 6. Day 1: Morning 7. 8. 3. Welcome 9. 1. 3.1. What is Rust? 10. 4. Hello World! 11. 1. 4.1. Small Example 12. 5. Why Rust? 13. 1. 5.1. Compile Time Guarantees 2. 5.2. Runtime Guarantees 3. 5.3. Modern Features 14. 6. Basic Syntax 15. 1. 6.1. Scalar Types 2. 6.2. Compound Types 3. 6.3. References 4. 1. 6.3.1. Dangling References 5. 6.4. Slices 6. 1. 6.4.1. String vs str 7. 6.5. Functions 8. 1. 6.5.1. Methods 2. 6.5.2. Overloading 16. 7. Exercises 17. 1. 7.1. Implicit Conversions 2. 7.2. Arrays and for Loops 18. 19. Day 1: Afternoon 20. 8. Variables 21. 1. 8.1. Type Inference 2. 8.2. static & const 3. 8.3. Scopes and Shadowing 22. 9. Memory Management 23. 1. 9.1. Stack vs Heap 2. 9.2. Stack Memory 3. 9.3. Manual Memory Management 4. 9.4. Scope-Based Memory Management 5. 9.5. Garbage Collection 6. 9.6. Rust Memory Management 7. 9.7. Comparison 24. 10. Ownership 25. 1. 10.1. Move Semantics 2. 10.2. Moved Strings in Rust 3. 1. 10.2.1. Double Frees in Modern C++ 4. 10.3. Moves in Function Calls 5. 10.4. Copying and Cloning 6. 10.5. Borrowing 7. 1. 10.5.1. Shared and Unique Borrows 8. 10.6. Lifetimes 9. 10.7. Lifetimes in Function Calls 10. 10.8. Lifetimes in Data Structures 26. 11. Exercises 27. 1. 11.1. Designing a Library 2. 11.2. Iterators and Ownership 28. 29. Day 2: Morning 30. 31. 12. Welcome 32. 13. Structs 33. 1. 13.1. Tuple Structs 2. 13.2. Field Shorthand Syntax 34. 14. Enums 35. 1. 14.1. Variant Payloads 2. 14.2. Enum Sizes 36. 15. Methods 37. 1. 15.1. Method Receiver 2. 15.2. Example 38. 16. Pattern Matching 39. 1. 16.1. Destructuring Enums 2. 16.2. Destructuring Structs 3. 16.3. Destructuring Arrays 4. 16.4. Match Guards 40. 17. Exercises 41. 1. 17.1. Health Statistics 2. 17.2. Points and Polygons 42. 43. Day 2: Afternoon 44. 18. Control Flow 45. 1. 18.1. Blocks 2. 18.2. if expressions 3. 18.3. if let expressions 4. 18.4. while expressions 5. 18.5. while let expressions 6. 18.6. for expressions 7. 18.7. loop expressions 8. 18.8. match expressions 9. 18.9. break & continue 46. 19. Standard Library 47. 1. 19.1. String 2. 19.2. Option and Result 3. 19.3. Vec 4. 19.4. HashMap 5. 19.5. Box 6. 1. 19.5.1. Recursive Data Types 2. 19.5.2. Niche Optimization 7. 19.6. Rc 48. 20. Modules 49. 1. 20.1. Visibility 2. 20.2. Paths 3. 20.3. Filesystem Hierarchy 50. 21. Exercises 51. 1. 21.1. Luhn Algorithm 2. 21.2. Strings and Iterators 52. 53. Day 3: Morning 54. 55. 22. Welcome 56. 23. Traits 57. 1. 23.1. Deriving Traits 2. 23.2. Default Methods 3. 23.3. Important Traits 4. 1. 23.3.1. Iterator 2. 23.3.2. From and Into 3. 23.3.3. Read and Write 4. 23.3.4. Add, Mul, ... 5. 23.3.5. Drop 58. 24. Generics 59. 1. 24.1. Generic Data Types 2. 24.2. Generic Methods 3. 24.3. Trait Bounds 4. 24.4. impl Trait 5. 24.5. Closures 6. 24.6. Monomorphization 7. 24.7. Trait Objects 60. 25. Exercises 61. 1. 25.1. A Simple GUI Library 62. 63. Day 3: Afternoon 64. 26. Error Handling 65. 1. 26.1. Panics 2. 1. 26.1.1. Catching Stack Unwinding 3. 26.2. Structured Error Handling 4. 26.3. Propagating Errors with ? 5. 1. 26.3.1. Converting Error Types 2. 26.3.2. Deriving Error Enums 3. 26.3.3. Adding Context to Errors 66. 27. Testing 67. 1. 27.1. Unit Tests 2. 27.2. Test Modules 3. 27.3. Documentation Tests 4. 27.4. Integration Tests 68. 28. Unsafe Rust 69. 1. 28.1. Dereferencing Raw Pointers 2. 28.2. Mutable Static Variables 3. 28.3. Calling Unsafe Functions 4. 28.4. Extern Functions 5. 28.5. Unions 70. 29. Exercises 71. 1. 29.1. Safe FFI Wrapper 72. 73. Day 4: Morning 74. 75. 30. Welcome 76. 31. Concurrency 77. 1. 31.1. Threads 2. 31.2. Scoped Threads 3. 31.3. Channels 4. 1. 31.3.1. Unbounded Channels 2. 31.3.2. Bounded Channels 5. 31.4. Shared State 6. 1. 31.4.1. Arc 2. 31.4.2. Mutex 3. 31.4.3. Example 7. 31.5. Send and Sync 8. 1. 31.5.1. Send 2. 31.5.2. Sync 3. 31.5.3. Examples 78. 32. Exercises 79. 1. 32.1. Dining Philosophers 2. 32.2. Multi-threaded Link Checker 80. 81. Day 4: Afternoon 82. 83. 33. Android 84. 1. 33.1. Setup 2. 33.2. Build Rules 3. 1. 33.2.1. Binary 2. 33.2.2. Library 4. 33.3. AIDL 5. 1. 33.3.1. Interface 2. 33.3.2. Implementation 3. 33.3.3. Server 4. 33.3.4. Deploy 5. 33.3.5. Client 6. 33.3.6. Changing API 6. 33.4. Logging 7. 33.5. Interoperability 8. 1. 33.5.1. With C 2. 1. 33.5.1.1. Calling C with Bindgen 2. 33.5.1.2. Calling Rust from C 3. 33.5.2. With C++ 4. 33.5.3. With Java 85. 34. Exercises 86. 87. Final Words 88. 35. Thanks! 89. 36. Other Resources 90. 37. Credits 91. 92. 93. Solutions 94. 95. 38. Solutions 96. 1. 38.1. Day 1 Morning 2. 38.2. Day 1 Afternoon 3. 38.3. Day 2 Morning 4. 38.4. Day 2 Afternoon 5. 38.5. Day 3 Morning 6. 38.6. Day 3 Afternoon 7. 38.7. Day 4 Morning * Light * Rust * Coal * Navy * Ayu Comprehensive Rust [ ] Welcome to Comprehensive Rust This is a four day Rust course developed by the Android team. The course covers 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. The goal of the course is to teach you Rust. We assume you don't know anything about Rust and hope to: * Give you a comprehensive understanding of the Rust syntax and language. * Enable you to modify existing programs and write new programs in Rust. * Show you common Rust idioms. On Day 4, we will cover Android-specific things such as: * Building Android components in Rust. * AIDL servers and clients. * Interoperability with C, C++, and Java. Non-Goals 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: * Learn how to use async Rust -- we'll only talk a bit about async Rust when covering traditional concurrency primitives. Please see Asynchronous Programming in Rust instead for details on this topic. * Learn how to develop macros, please see Chapter 19.5 in the Rust Book and Rust by Example instead. * Learn the details of how to write unsafe Rust. We will talk about unsafe Rust on Day 3, but we do not cover the subtle details. Please see Chapter 19.1 in the Rust Book and the Rustonomicon instead. Assumptions The course assumes that you already know how to program. Rust is a statically typed language and we will sometimes make comparisons with C and C++ to better explain or contrast the Rust approach. If you know how to program in a dynamically typed language such as Python or JavaScript, then you will be able to follow along just fine too.