You've already forked comprehensive-rust
							
							
				mirror of
				https://github.com/google/comprehensive-rust.git
				synced 2025-10-31 08:37:45 +02:00 
			
		
		
		
	Reorder material on first two days (#913)
- Morning of Day 1 still introduces the language and its high-level goals/value proposition, and starts with the built-in data types Rust provides, and how you define a function. - Afternoon of Day 1 gets a front loading of the basic control flow structures in Rust but not the more exotic ones. - The exercises for day 1 afternoon will be the Luhn algorithm (where we can match on digits and enums such as `Option`. - Morning of day 2 still has discussion of memory management. Fixes #510. --------- Co-authored-by: Martin Geisler <mgeisler@google.com>
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							e55361233e
						
					
				
				
					commit
					d3a90373b0
				
			| @@ -72,6 +72,11 @@ line-numbers = true | ||||
| "unsafe/unsafe-functions.html" = "calling-unsafe-functions.html" | ||||
| "welcome-bare-metal.html" = "bare-metal.html" | ||||
| "welcome-day-4.html" = "concurrency.html" | ||||
| # Moving exercises between days | ||||
| "exercises/day-2/luhn.html" = "../day-1/luhn.html" | ||||
| "exercises/day-2/points-polygons.html" = "../day-3/points-polygons.html" | ||||
| "exercises/day-1/book-library.html" = "../day-2/book-library.html" | ||||
| "exercises/day-1/iterators-and-ownership.html" = "../day-2/iterators-and-ownership.html" | ||||
| # Send people to canonical URL instead of index.html | ||||
| "welcome.html" = "./" | ||||
|  | ||||
|   | ||||
| @@ -41,10 +41,43 @@ | ||||
|  | ||||
| # Day 1: Afternoon | ||||
|  | ||||
| - [Control Flow](control-flow.md) | ||||
|   - [Blocks](control-flow/blocks.md) | ||||
|   - [if expressions](control-flow/if-expressions.md) | ||||
|   - [for expressions](control-flow/for-expressions.md) | ||||
|   - [while expressions](control-flow/while-expressions.md) | ||||
|   - [break & continue](control-flow/break-continue.md) | ||||
|   - [loop expressions](control-flow/loop-expressions.md) | ||||
|  | ||||
| - [Variables](basic-syntax/variables.md) | ||||
|   - [Type Inference](basic-syntax/type-inference.md) | ||||
|   - [static & const](basic-syntax/static-and-const.md)) | ||||
|   - [Scopes and Shadowing](basic-syntax/scopes-shadowing.md) | ||||
| - [Enums](enums.md) | ||||
|   - [Variant Payloads](enums/variant-payloads.md) | ||||
|   - [Enum Sizes](enums/sizes.md) | ||||
|  | ||||
| - [Novel Control Flow](control-flow/novel.md) | ||||
|   - [if let expressions](control-flow/if-let-expressions.md) | ||||
|   - [while let expressions](control-flow/while-let-expressions.md) | ||||
|   - [match expressions](control-flow/match-expressions.md) | ||||
|  | ||||
| - [Pattern Matching](pattern-matching.md) | ||||
|   - [Destructuring Enums](pattern-matching/destructuring-enums.md) | ||||
|   - [Destructuring Structs](pattern-matching/destructuring-structs.md) | ||||
|   - [Destructuring Arrays](pattern-matching/destructuring-arrays.md) | ||||
|   - [Match Guards](pattern-matching/match-guards.md) | ||||
|  | ||||
| - [Exercises](exercises/day-1/afternoon.md) | ||||
|   - [Luhn Algorithm](exercises/day-1/luhn.md) | ||||
|   - [Pattern Matching (TBD)]() | ||||
|  | ||||
| # Day 2: Morning | ||||
|  | ||||
| ---- | ||||
|  | ||||
| - [Welcome](welcome-day-2.md) | ||||
|  | ||||
| - [Memory Management](memory-management.md) | ||||
|   - [Stack vs Heap](memory-management/stack-vs-heap.md) | ||||
|   - [Stack Memory](memory-management/stack.md) | ||||
| @@ -64,46 +97,21 @@ | ||||
|   - [Lifetimes](ownership/lifetimes.md) | ||||
|   - [Lifetimes in Function Calls](ownership/lifetimes-function-calls.md) | ||||
|   - [Lifetimes in Data Structures](ownership/lifetimes-data-structures.md) | ||||
| - [Exercises](exercises/day-1/afternoon.md) | ||||
|   - [Storing Books](exercises/day-1/book-library.md) | ||||
|   - [Iterators and Ownership](exercises/day-1/iterators-and-ownership.md) | ||||
| - [Exercises](exercises/day-2/morning.md) | ||||
|   - [Storing Books](exercises/day-2/book-library.md) | ||||
|   - [Iterators and Ownership](exercises/day-2/iterators-and-ownership.md) | ||||
|  | ||||
|  | ||||
| # Day 2: Morning | ||||
|  | ||||
| ---- | ||||
|  | ||||
| - [Welcome](welcome-day-2.md) | ||||
| - [Structs](structs.md) | ||||
|   - [Tuple Structs](structs/tuple-structs.md) | ||||
|   - [Field Shorthand Syntax](structs/field-shorthand.md) | ||||
| - [Enums](enums.md) | ||||
|   - [Variant Payloads](enums/variant-payloads.md) | ||||
|   - [Enum Sizes](enums/sizes.md) | ||||
| - [Methods](methods.md) | ||||
|   - [Method Receiver](methods/receiver.md) | ||||
|   - [Example](methods/example.md) | ||||
| - [Pattern Matching](pattern-matching.md) | ||||
|   - [Destructuring Enums](pattern-matching/destructuring-enums.md) | ||||
|   - [Destructuring Structs](pattern-matching/destructuring-structs.md) | ||||
|   - [Destructuring Arrays](pattern-matching/destructuring-arrays.md) | ||||
|   - [Match Guards](pattern-matching/match-guards.md) | ||||
| - [Exercises](exercises/day-2/morning.md) | ||||
| - [Exercises](exercises/day-2/afternoon.md) | ||||
|   - [Health Statistics](exercises/day-2/health-statistics.md) | ||||
|   - [Points and Polygons](exercises/day-2/points-polygons.md) | ||||
|  | ||||
| # Day 2: Afternoon | ||||
|  | ||||
| - [Control Flow](control-flow.md) | ||||
|   - [Blocks](control-flow/blocks.md) | ||||
|   - [if expressions](control-flow/if-expressions.md) | ||||
|   - [if let expressions](control-flow/if-let-expressions.md) | ||||
|   - [while expressions](control-flow/while-expressions.md) | ||||
|   - [while let expressions](control-flow/while-let-expressions.md) | ||||
|   - [for expressions](control-flow/for-expressions.md) | ||||
|   - [loop expressions](control-flow/loop-expressions.md) | ||||
|   - [match expressions](control-flow/match-expressions.md) | ||||
|   - [break & continue](control-flow/break-continue.md) | ||||
| - [Standard Library](std.md) | ||||
|   - [Option and Result](std/option-result.md) | ||||
|   - [String](std/string.md) | ||||
| @@ -119,7 +127,6 @@ | ||||
|   - [Paths](modules/paths.md) | ||||
|   - [Filesystem Hierarchy](modules/filesystem.md) | ||||
| - [Exercises](exercises/day-2/afternoon.md) | ||||
|   - [Luhn Algorithm](exercises/day-2/luhn.md) | ||||
|   - [Strings and Iterators](exercises/day-2/strings-iterators.md) | ||||
|  | ||||
|  | ||||
| @@ -149,6 +156,7 @@ | ||||
|   - [Closures: Fn, FnMut, FnOnce](traits/closures.md) | ||||
| - [Exercises](exercises/day-3/morning.md) | ||||
|   - [A Simple GUI Library](exercises/day-3/simple-gui.md) | ||||
|   - [Points and Polygons](exercises/day-3/points-polygons.md) | ||||
|  | ||||
| # Day 3: Afternoon | ||||
|  | ||||
|   | ||||
							
								
								
									
										8
									
								
								src/control-flow/novel.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/control-flow/novel.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| # Novel Control Flow | ||||
|  | ||||
| Rust has a few control flow constructs which differ from other languages. They | ||||
| are used for pattern matching: | ||||
|  | ||||
| - `if let` expressions | ||||
| - `while let` expressions | ||||
| - `match` expressions | ||||
| @@ -8,30 +8,30 @@ publish = false | ||||
| name = "for-loops" | ||||
| path = "day-1/for-loops.rs" | ||||
|  | ||||
| [[bin]] | ||||
| name = "book-library" | ||||
| path = "day-1/book-library.rs" | ||||
|  | ||||
| [[bin]] | ||||
| name = "points-polygons" | ||||
| path = "day-2/points-polygons.rs" | ||||
|  | ||||
| [[bin]] | ||||
| name = "luhn" | ||||
| path = "day-2/luhn.rs" | ||||
| path = "day-1/luhn.rs" | ||||
|  | ||||
| [[bin]] | ||||
| name = "book-library" | ||||
| path = "day-2/book-library.rs" | ||||
|  | ||||
| [[bin]] | ||||
| name = "strings-iterators" | ||||
| path = "day-2/strings-iterators.rs" | ||||
|  | ||||
| [[bin]] | ||||
| name = "safe-ffi-wrapper" | ||||
| path = "day-3/safe-ffi-wrapper.rs" | ||||
|  | ||||
| [[bin]] | ||||
| name = "simple-gui" | ||||
| path = "day-3/simple-gui.rs" | ||||
|  | ||||
| [[bin]] | ||||
| name = "points-polygons" | ||||
| path = "day-3/points-polygons.rs" | ||||
|  | ||||
| [[bin]] | ||||
| name = "safe-ffi-wrapper" | ||||
| path = "day-3/safe-ffi-wrapper.rs" | ||||
|  | ||||
| [[bin]] | ||||
| name = "dining-philosophers" | ||||
| path = "concurrency/dining-philosophers.rs" | ||||
|   | ||||
| @@ -2,9 +2,9 @@ | ||||
|  | ||||
| We will look at two things: | ||||
|  | ||||
| * A small book library, | ||||
| * The Luhn algorithm, | ||||
|  | ||||
| * Iterators and ownership (hard). | ||||
| * An exercise on pattern matching. | ||||
|  | ||||
| <details> | ||||
|  | ||||
|   | ||||
| @@ -1,9 +1,13 @@ | ||||
| # Day 1 Afternoon Exercises | ||||
|  | ||||
| ## Designing a Library | ||||
| ## Luhn Algorithm | ||||
|  | ||||
| ([back to exercise](book-library.md)) | ||||
| ([back to exercise](luhn.md)) | ||||
|  | ||||
| ```rust | ||||
| {{#include book-library.rs}} | ||||
| {{#include luhn.rs}} | ||||
| ``` | ||||
|  | ||||
| ## Pattern matching | ||||
|  | ||||
| TBD. | ||||
|   | ||||
| @@ -1,13 +1,5 @@ | ||||
| # Day 2 Afternoon Exercises | ||||
|  | ||||
| ## Luhn Algorithm | ||||
|  | ||||
| ([back to exercise](luhn.md)) | ||||
|  | ||||
| ```rust | ||||
| {{#include luhn.rs}} | ||||
| ``` | ||||
|  | ||||
| ## Strings and Iterators | ||||
|  | ||||
| ([back to exercise](strings-iterators.md)) | ||||
|   | ||||
| @@ -1,9 +1,9 @@ | ||||
| # Day 2 Morning Exercises | ||||
|  | ||||
| ## Points and Polygons | ||||
| ## Designing a Library | ||||
|  | ||||
| ([back to exercise](points-polygons.md)) | ||||
| ([back to exercise](book-library.md)) | ||||
|  | ||||
| ```rust | ||||
| {{#include points-polygons.rs}} | ||||
| {{#include book-library.rs}} | ||||
| ``` | ||||
|   | ||||
| @@ -1,6 +1,8 @@ | ||||
| # Day 3: Morning Exercises | ||||
|  | ||||
| We will design a classical GUI library traits and trait objects. | ||||
| We will design a classical GUI library using traits and trait objects. | ||||
|  | ||||
| We will also look at enum dispatch with an exercise involving points and polygons. | ||||
|  | ||||
| <details> | ||||
|  | ||||
|   | ||||
| @@ -7,3 +7,11 @@ | ||||
| ```rust | ||||
| {{#include simple-gui.rs}} | ||||
| ``` | ||||
|  | ||||
| ## Points and Polygons | ||||
|  | ||||
| ([back to exercise](points-polygons.md)) | ||||
|  | ||||
| ```rust | ||||
| {{#include points-polygons.rs}} | ||||
| ``` | ||||
|   | ||||
| @@ -4,9 +4,9 @@ | ||||
|  | ||||
| The course is fast paced and covers a lot of ground: | ||||
|  | ||||
| * Day 1: Basic Rust, ownership and the borrow checker. | ||||
| * Day 2: Compound data types,  pattern matching, the standard library. | ||||
| * Day 3: Traits and generics, error handling, testing, unsafe Rust. | ||||
| * Day 1: Basic Rust, syntax, control flow, creating and consuming values. | ||||
| * Day 2: Memory management, ownership, compound data types, and the standard library. | ||||
| * Day 3: Generics, traits, error handling, testing, and unsafe Rust. | ||||
|  | ||||
| ## Deep Dives | ||||
|  | ||||
|   | ||||
| @@ -6,10 +6,10 @@ today: | ||||
| * Basic Rust syntax: variables, scalar and compound types, enums, structs, | ||||
|   references, functions, and methods. | ||||
|  | ||||
| * Memory management: stack vs heap, manual memory management, scope-based memory | ||||
|   management, and garbage collection. | ||||
| * Control flow constructs: `if`, `if let`, `while`, `while let`, `break`, and | ||||
|   `continue`. | ||||
|  | ||||
| * Ownership: move semantics, copying and cloning, borrowing, and lifetimes. | ||||
| * Pattern matching: destructuring enums, structs, and arrays. | ||||
|  | ||||
| <details> | ||||
|  | ||||
|   | ||||
| @@ -2,12 +2,12 @@ | ||||
|  | ||||
| Now that we have seen a fair amount of Rust, we will continue with: | ||||
|  | ||||
| * Structs, enums, methods. | ||||
| * Memory management: stack vs heap, manual memory management, scope-based memory | ||||
|   management, and garbage collection. | ||||
|  | ||||
| * Pattern matching: destructuring enums, structs, and arrays. | ||||
| * Ownership: move semantics, copying and cloning, borrowing, and lifetimes. | ||||
|  | ||||
| * Control flow constructs: `if`, `if let`, `while`, `while let`, `break`, and | ||||
|   `continue`. | ||||
| * Structs and methods. | ||||
|  | ||||
| * The Standard Library: `String`, `Option` and `Result`, `Vec`, `HashMap`, `Rc` | ||||
|   and `Arc`. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user