# Programming with Rust Study notes from the Donis Marshall book [ISBN-13: 978-0-13-7889 65-5] --- ## 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 - Print - 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 `if` Expression - The `while` Expression * The `break` and `continue` * keywords - The `for` Expression - The `loop` Expression * The `loop break` Expression * The `loop` Label - 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 - `Impl` Blocks - Operator Overloading * Unary Operator Overloading * Binary Operator Overloading - Tuple Struct - Unit-Like Struct - Summary ### 14. Generics - Generic Functions - Bounds - The `where` Clause - 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 `Fn` Trait * The `FnMut` Trait * The `FnOnce` Trait * The `move` Keyword * The `Impl` Keyword - 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 `try` Methods - 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 `path` Attribute - Functions and Modules - The `crate`, `super`, and `self` Keywords - Legacy Model - Summary ### Index