Learn to Code with Rust

Video description

This course begins by guiding you through the essential setup process, helping you configure your environment on macOS or Windows, and crafting your first Rust project. From there, you'll master variables, data types, and control flow, ensuring a solid understanding of Rust's syntax and semantics.

As you progress, explore Rust's innovative concepts like ownership, borrowing, and lifetimes. These principles, combined with lessons on enums, generics, and error handling, will enhance your ability to write efficient, bug-free code. Delve into Rust's memory safety guarantees without sacrificing performance, learning to leverage features like the Option and Result enums for error management.

Finally, unlock Rust's advanced capabilities by building modules, working with traits, and understanding lifetimes. Gain the confidence to design scalable and maintainable projects, culminating in a robust understanding of the language. With clear explanations and hands-on exercises, this course ensures you are well-equipped to thrive in Rust's growing ecosystem.

To access the supplementary materials, scroll down to the 'Resources' section above the 'Course Outline' and click 'Supplemental Content.' This will either initiate a download or redirect you to GitHub.

What you will learn

  • Set up a Rust development environment on macOS or Windows
  • Write, compile, and run Rust programs
  • Master key Rust concepts like ownership, borrowing, and lifetimes
  • Use enums, traits, and generics to build modular, reusable code
  • Implement effective error handling with Option and Result enums
  • Create efficient, memory-safe applications leveraging Rust's advanced features

Audience

This course is ideal for developers eager to learn Rust, whether transitioning from another programming language or starting fresh. Basic programming experience is recommended but not required. A willingness to learn new paradigms and tools is essential.

About the Author

Boris Paskhaver : Boris Paskhaver is a New York City-based software engineer, author, and Udemy instructor with a unique journey into tech. Graduating from NYU in 2013 with a degree in Business Economics and Marketing, he initially worked in various roles, including business analyst and data analyst, at several companies. His coding journey began accidentally while building projects with Python and JavaScript, leading him to passionately pursue programming. Without formal computer science education, Boris completed App Academy's full-stack web development bootcamp, diving headfirst into web development. As an instructor, Boris focuses on creating comprehensive, easy-to-understand courses, addressing the challenges he faced learning to code. He's driven by the intersection of technology and education, aiming to make programming accessible to all. Boris brings this passion to his teaching, helping others unlock the potential of coding.

Table of contents

  1. Chapter 1 : Getting Started
    1. Intro to Rust
    2. The Rust Compiler
    3. [macOS] Intro to Terminal
    4. [macOS] Installing XCode Command Line Tools
    5. [macOS] Installing Rust
    6. [macOS] Installing Visual Studio Code
    7. [macOS] Add VSCode to PATH
    8. [Windows] Intro to PowerShell
    9. [Windows] Find Out Your Windows Operating System
    10. [Windows] Installing Visual Studio
    11. [Windows] Installing Rust
    12. [Windows] Installing Visual Studio Code
    13. Updating or Uninstalling Rust with rustup
    14. Create Rust Project with Cargo
    15. Hello World
    16. Compiling and Running Rust File from the Terminal
    17. Formatting with rustfmt and cargo fmt
    18. The cargo build Command
    19. The cargo run Command
    20. The cargo check Command
    21. Comments
    22. Section Review
  2. Chapter 2 : Variables and Mutability
    1. Intro to Variables
    2. Interpolation with Curly Braces
    3. Positional Arguments to println!
    4. Underscore with Variables
    5. Immutable and Mutable Variables
    6. Rust Error Codes Index
    7. Variable Shadowing
    8. Scopes
    9. Constants
    10. Type Aliases
    11. Compiler Directives
    12. Section Review
  3. Chapter 3 : Data Types
    1. Intro to Data Types
    2. Integers
    3. Using _ as Visual Separator for Numbers
    4. The usize and isize Types
    5. Strings and Raw Strings
    6. Intro to Methods
    7. Floating Point Types
    8. Formatting Floats with Format Specifier
    9. Casting Types with the as Keyword
    10. Math Operations
    11. Augmented Assignment Operator
    12. Intro to Booleans
    13. Boolean Inversion with !
    14. Equality and Inequality Operators
    15. And Logic with
    16. Or Logic with
    17. The Character Type
    18. The Array Type
    19. Reading and Writing Array Elements
    20. The Display Trait
    21. The Debug Trait
    22. The dbg! Macro
    23. The Tuple Type
    24. Ranges and Range Iteration
    25. Intro to Generics
    26. Section Review
  4. Chapter 4 : Functions
    1. Intro to Functions
    2. Parameters and Arguments
    3. Explicit Return Values
    4. Implicit Return Values
    5. The Unit as a Return Type
    6. Blocks in Functions
    7. Section Review
  5. Chapter 5 : Control Flow
    1. The if Statement
    2. The else if Statement
    3. The else Statement
    4. Assigning Result of if Statement to Variable
    5. The match Statement
    6. Underscore in a Match Arm
    7. The match Statement with Multiple Values and Conditionals
    8. The loop and break Keywords
    9. The continue Keyword
    10. While Loop
    11. Recursion
    12. Section Review
  6. Chapter 6 : Ownership
    1. Intro to Ownership
    2. The Stack and Heap
    3. Scope and Ownership
    4. The Copy Trait
    5. The String Type
    6. The push_str Method on a String Type
    7. Moves and Ownership
    8. The drop Function
    9. The clone Method
    10. References and Borrowing
    11. The Dereference Operator
    12. String, , str, and
    13. The Copy Trait with References
    14. Ownership and Function Parameters
    15. Mutable Parameters
    16. Return Values I
    17. Return Values II
    18. Section Review
  7. Chapter 7 : References and Borrowing
    1. Immutable and Mutable Reference Parameters
    2. Multiple Immutable References
    3. Mutable Reference Restrictions
    4. Ownership with Immutable and Mutable References
    5. Dangling References
    6. Ownership with Arrays and Tuples
    7. Section Review
  8. Chapter 8 : Slices
    1. Intro to Slices
    2. Create a String Slice from a String
    3. String Slices and String Literals
    4. String Slice Lengths
    5. Syntactic Shortcuts
    6. String Slices as Function Parameters
    7. Array Slices
    8. Deref Coercion with Array Slices
    9. Mutable Array Slices
    10. Section Review
  9. Chapter 9 : Structs
    1. Define a Struct
    2. Create a Struct Instance
    3. Access Struct Fields
    4. Overwrite Struct Fields
    5. Create Structs in a Function
    6. Struct Field Initialization Shorthand Syntax
    7. Struct Update Syntax
    8. Passing Structs into a Function
    9. Deriving Debug Trait for Struct
    10. Defining Struct Methods
    11. self Parameter as Mutable Struct Instance
    12. self Parameter as Immutable and Mutable References to Struct Instance
    13. Methods with Multiple Parameters
    14. Calling Methods from Other Methods
    15. Associated Functions
    16. Multiple impl Blocks
    17. Builder Pattern
    18. Tuple Structs
    19. Unit-Like Structs
    20. Section Review
  10. Chapter 10 : Enums
    1. Intro to Enums
    2. Enum with Associated Values I
    3. Enum with Associated Values II
    4. A Brief Discussion on Enum Memory
    5. Struct Variants
    6. Nesting Enums in Enums
    7. The match Keyword I
    8. The match Keyword II
    9. The match Keyword III
    10. Defining Methods on Enums
    11. The match Keyword IV - Catching Multiple Values
    12. The match Keyword V - match with Exact Value
    13. The if let Construct
    14. Section Review
  11. Chapter 11 : Generics
    1. Intro to Generics
    2. The Turbofish Operator
    3. Multiple Generics
    4. Generics in Structs
    5. Generics and impl Blocks I
    6. Generics and impl Blocks II
    7. Generics in Enums
    8. Section Review
  12. Chapter 12 : Option and Result Enums
    1. The Option Enum
    2. Real Example of Option Enum (The get Method on an Array)
    3. The unwrap and expect Methods
    4. The match Keyword with Option Enum
    5. Returning an Option Enum from a Function
    6. Top-Level Option Variants
    7. The unwrap_or Method
    8. Building Option from Scratch
    9. The Result Enum
    10. Real Example of Result Enum (The parse Method on a String)
    11. Returning a Result Enum from a Function
    12. Result Methods
    13. Nuances of unwrap Method on Result
    14. Section Review
  13. Chapter 13 : Vectors
    1. Create a Vector
    2. Adding and Removing Elements
    3. Reading Vector Elements
    4. The get Method
    5. Ownership with Vectors
    6. Writing Vector Elements
    7. Vector Capacity Behind the Scenes
    8. Section Review
  14. Chapter 14 : Project Structure
    1. Packages and Crates
    2. Intro to Modules
    3. The pub Keyword
    4. The Benefit of Namespaces
    5. Module as File
    6. Module as Folder
    7. Module Ambiguity
    8. Public Enums, Public Structs, and Public Fields
    9. Submodules
    10. The crate Prefix
    11. The use Keyword I
    12. The use Keyword II (Name Conflicts)
    13. The self Keyword
    14. The super Keyword
    15. Create Aliases with the as Keyword
    16. Using pub use to Export Names from Submodules
    17. External Crates
    18. The Standard Library
    19. The Glob Operator
    20. Create Library Crate
    21. Multiple Binary Crates
    22. Documentation Comments
    23. Walking Through Sample Module Structure
    24. Section Review
  15. Chapter 15 : Strings
    1. Review of Strings
    2. Concatenation
    3. The format! Macro
    4. Common String Methods (trim, casing, replace, split)
    5. Collecting User Input with read_line Method
    6. Section Review
  16. Chapter 16 : HashMaps
    1. Create a HashMap with new Function
    2. The remove Method
    3. Hash Maps and Ownership
    4. Access a Value by Key
    5. Overwriting a Value with an Existing Key
    6. The entry Method
    7. Section Review
  17. Chapter 17 : Error Handling
    1. The panic! Macro
    2. The process Module and the exit Function
    3. Standard Error (eprintln! Macro)
    4. Opening a File
    5. Asking the User for Input
    6. Reading the File's Contents
    7. Propagating Errors
    8. Understanding Error Type Redeclaration
    9. The ? Operator
    10. The read_to_string Associated Function
    11. Using ? with Option
    12. Section Review
  18. Chapter 18 : Traits
    1. Intro to Traits
    2. Defining a Trait
    3. Implementing Trait for Struct I
    4. Implementing Trait for Struct II
    5. Default Implementations
    6. Calling Trait Method from Another Method
    7. Traits for Function Parameter Constraints
    8. Trait Bound Syntax
    9. Multiple Trait Bounds
    10. where Clauses
    11. Traits as Function Return Values
    12. Trait Bounds to Conditionally Implement Methods
    13. A Preview of Trait Objects
    14. Trait Must be In Scope to Use its Definitions
    15. Moving to Project Structure I
    16. Moving to Project Structure II (Multiple Modules)
    17. Associated Constants in a Trait
    18. Getters in Traits
    19. Setters in Traits
    20. Supertraits I (Trait Inheritance)
    21. Traits with Generics
    22. Implementing the Display Trait on a Struct
    23. Implementing the Display Trait on an Enum
    24. Implementing the Debug Trait
    25. Formatter Methods
    26. Implementing the Drop Trait
    27. Implementing the Clone Trait
    28. Implementing the Copy Trait
    29. Implementing the PartialEq Trait for Structs
    30. Defining Equality for Different Types
    31. Implementing the PartialEq Trait for Enums
    32. Implementing the Eq Trait
    33. Implementing the PartialOrd Trait
    34. Associated Types I
    35. Associated Types II
    36. Section Review
  19. Chapter 19 : Lifetimes
    1. Concrete Lifetimes for Values I
    2. Concrete Lifetimes for Values II
    3. Concrete Lifetimes for References
    4. Non-Lexical Lifetimes
    5. Invalid Lifetimes I
    6. Invalid Lifetimes II
    7. Functions Cannot Return References to Owned Values or Parameters
    8. References as Function Parameters
    9. Intro to Generic Lifetimes
    10. Lifetimes and Referents
    11. Lifetime Elision Rules I
    12. Multiple Parameters I
    13. Multiple Parameters II
    14. Lifetime Elision Rules II
    15. Lifetimes in Structs
    16. Multiple Lifetimes
    17. The static Lifetime
    18. Section Review
  20. Chapter 20 : Congratulations
    1. Congratulations

Product information

  • Title: Learn to Code with Rust
  • Author(s): Boris Paskhaver
  • Release date: November 2024
  • Publisher(s): Packt Publishing
  • ISBN: 9781837024155