mirror of
https://github.com/learning-forge/marshal-rust.git
synced 2026-11-30 21:30:31 +00:00
- Add .gitignore to exclude local book PDFs and compiled Rust artifacts - Document reference book metadata and 3-part study loop in README.md and NOTES_TEMPLATE.md - Rewrite 01-introduction-to-rust/README.md as a concise active-learning example with mylib/ listings - Adapt 02-getting-started/README.md to template with NixOS Home Manager toolchain setup
6.2 KiB
6.2 KiB
Programming with Rust
Personal study notes, compiler experiments, and exercises following Donis Marshall, Programming with Rust (Pearson Education, 2024).
Reference Material
- Book: Programming with Rust by Donis Marshall
- Publisher / Year: Pearson Education / Addison-Wesley Professional (2024)
- ISBN-13:
978-0-13-788965-5 - Note: The book PDF is kept locally for personal study and is intentionally excluded from git tracking via
.gitignore.
Study Methodology
Instead of transcribing chapters verbatim, each chapter follows a 3-part active loop (see NOTES_TEMPLATE.md and 01-introduction-to-rust/README.md for an example):
- Mental Model (3–5 bullets in my own words): What problem does this solve, and how does it differ from dynamic languages?
- Break-It Experiments: Run code in
cargoand intentionally break rules to readrustc's error messages. - Friction Log & Recall Prompts: Record actual compiler errors/misconceptions and 2–3 questions to answer from memory.
Contents:
1. Introduction to Rust
- Introduction
- Functional Programming
- Expression Oriented
- Pattern-Oriented
- Features
- Safeness
- Ownership
- Lifetimes
- Fearless Concurrency
- Zero-Cost Abstraction
- Rust Terminology
- Tools
- A Note About Securit
- Summary
2. Getting Started
- Preliminaries
- Rust and Windows (Linux)
- Installing Rust
- Advanced Rustup
- "Hello, World"
- Compile and Run
- Cargo
- Library
- Comments
- Published Crates
- Main Function
- Command-Line Arguments
- Summary
3. Variables
-
Terminology
-
Variables
-
Primitives
-
Integer Types
-
Overflow
-
Notations
-
Floating Point Types
-
Floating Point Constants
-
Infinity
-
NaN
-
Numeric Ranges
-
Casting
-
Boolean Types
-
Char
-
Pointers
- References
-
Operators
-
Summary
4. Strings
- Str
- String
- Lenght
- Extending a String
- Capacity
- Accessing a String Value
- Deref Coercion
- Formatted Strings
- Helpful Functions
- Summary
5. Console
- Positional Arguments
- Variable Arguments
- Named Arguments
- Padding, Alignment, and Precision
- Base
- Developer Facing
Write!Macro- Display Trait
- Debug Trait
Format!Macro- Console Read and Write
- Summary
6. Control Flow
- The
ifExpression - The
whileExpression- The
breakandcontinue - keywords
- The
- The
forExpression - The
loopExpression- The
loop breakExpression - The
loopLabel
- The
- The Iterator Trait
- Summary
7. Collections
- Arrays
- Multidimensional Arrays
- Accessing Array Values
- Slices
- Comparing Arrays
- Iteration
- Coercion
- Vectors
- Multidimensional
- Access
- Iteration
- Resizing
- Capacity
- HashMap
- Creating a HashMap
- Accessing the HashMap
- Updating an Entry
- Iteration
- Summary
8. Ownership
- Stack and Heap Memory
- Shallow versus Deep Copy
- Car Analogy
- Move Semantics
- Borrow
- Copy Semantics
- Clone Trait
- Copy Trait
- Summary
9. Lifetimes
- Introduction to Lifetimes
- Function Headers and Lifetimes
- Lifetime annotation
- Lifetime Elision
- Complex Lifetimes
- Sharing a Lifetime
- Static Lifetimes
- Methods and Lifetimes
- Subtyping Lifetimes
- Anonymous Lifetimes
- Generics and Lifetimes
- Summary
10. References
- Declaration
- Borrowing
- Dereferencing
- Comparing References
- Reference Notation
- Reference to Reference
- Mutability
- Limits to Multiple Borrowers
- Summary
11. Functions
- Function Definition
- Parameters
- Function Return
- Const Functions
- Nested Functions
- Function Pointers
- Function Aliases
- Summary
12. Error Handling
- Handling Error Handling
- The Result Enum
- The Option Enum
- Panics
Panic!Macro- Handling Panics
- Unwrapping
- Match Pattern for Result and Option
- Map
- Rich Errors
- Custom Errors
- Summary
13. Structures
- Alternate Initialization
- Move Semantics
- Mutability
- Methods
- Self
- Associated Functions
ImplBlocks- Operator Overloading
- Unary Operator Overloading
- Binary Operator Overloading
- Tuple Struct
- Unit-Like Struct
- Summary
14. Generics
- Generic Functions
- Bounds
- The
whereClause - Structs
- Associated Functions
- Enums
- Generic Traits
- Explicit Specialization
- Summary
15. Patterns
- Let Statements
- Wildcards
- Complex Patterns
- Ownership
- Irrefutable
- Ranges
- Multiple Patterns
- Control Flow
- Structs
- Functions
- Match Expessions
- Match Guards
- Summary
16. Closures
- "Hello, World"
- Closure Syntax
- Closed Over
- Closures as Function Arguments
- Closures as Function Return Values
- Implementation of Closures
- The
FnTrait - The
FnMutTrait - The
FnOnceTrait - The
moveKeyword - The
ImplKeyword
- The
- Matrix Example
- Summary
17. Traits
- Trait Definition
- Default Functions
- Marker Trait
- Associated Functions
- Associated Types
- Extension Methods
- Fully Qualified Syntax
- Supertraits
- Static Dispatch
- Dynamic Dispatch
- Enums and Traits
- Summary
18. Threads 1
- Synchronous Function Calls
- Threads
- The Thread Type
- Processor Time
- Builder
- Communicating Sequential Process
- Asynchronous Channel
- Synchronous Channel
- Rendezvous Channel
- The
tryMethods - Store Example
- Summary
19. Threads 2
- Mutex
- Nonscoped Mutex
- Mutex Poisoning
- Reader-Writer Lock
- Condition Variables
- Atomic Operations
- Store and Load
- Fetch and Modify
- Compare and Exchange
- Summary
20. Memory
- Stacks
- Static Values
- The Heap
- Interior Mutability
- RefCell
- OnceCell
- Summary
21. Macros
- Tokens
- Declarative Macros
- Repetition
- Multiple Macro Matchers
- Procedural Macros
- Derive Macros
- Attribute Macros
- Function-Like Macros
- Summary
22. Interoperability
- Foreign Function Interface
- Basic Example
- Libc Crate
- Structs
- Bindgen
- C Calling Rust Functions
- Cbindgen
- Summary
23. Modules
- Module Items
- Module Files
- The
pathAttribute
- Functions and Modules
- The
crate,super, andselfKeywords - Legacy Model
- Summary